| ||||||||||
| 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 | |||||||||
我知道了,是4。54, 刚才2*pi-a也改了---但还wa :。(,高手们再看看。。In Reply To:2*pi*r*1/4=4.71,,,那4.54是怎么算的 ? Posted by:fjnu_jxd_010 at 2005-07-28 15:51:16 #include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main()
{
double r, h, d1, a1,d2,a2,pi=3.1415926535898,R,w,ld,sha,dm,da,h1,slo,a;//
while(cin>>r>>h>>d1>>a1>>d2>>a2)
{ if(fabs(a1-a2)==0||fabs(a1-a2)==360)
slo=fabs(d1-d2);
else
{
a1=a1/360.0*2.0*pi;
a2=a2/360.0*2*pi;
R=sqrt(r*r+h*h);
a=fabs(a1-a2);
// else
// {
if(d1>d2)
{ da=d1;dm=d2;}
else
{da=d2;dm=d1;}
if(a>pi)
a=2*pi-a;
w=2.0*pi*r/R*a/(2*pi);
sha=sin(w)*d1*d2;
h1=sha/da;
ld=sqrt(dm*dm-h1*h1);
slo=sqrt(h1*h1+(da-ld)*(da-ld));
}
cout<<fixed<<setprecision(2)<<slo<<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