| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
更简单的程序, 呵呵#include <iostream.h>
#include <math.h>
#include <iomanip.h>
double min(double x ,double y)
{
return x<y?x : y ;
}
int main()
{
double r , h , d1 , a1 , d2 , a2 ,x ,d;
double pi = 2.0* asin(1);
while(cin >> r >> h >> d1 >> a1 >> d2 >> a2)
{
x = r*fabs(a1 - a2)/sqrt( r*r + h*h) * pi/180.0;
x = min(x , 2*pi*r/sqrt( r*r + h*h) -x);
d = sqrt( d1*d1+ d2*d2 - 2*d1*d2*cos(x));
cout<< fixed << setpricision(2) << endl;
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator