| ||||||||||
| 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 | |||||||||
谁路过看一下我的程序,wa中。。。好多数据都行In Reply To:you are wrong Posted by:frkstyc at 2005-07-27 17:27:01 #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=a-pi;
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