| ||||||||||
| 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 | |||||||||
Re:我这个为什么是WA啊(好像少考虑了一种情况,仅供参考)In Reply To:我这个为什么是WA啊~~~~~ 55555555555555 Posted by:chris2007_1984 at 2004-10-18 21:49:28 #include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;
const double PI=(2.0*asin(1.0));
int main(void)
{
double x,y,z,role,half,max;
double R,r,triple,area;
int hujk=1;
cin>>x>>y>>z>>role;
while(x+y+z+role)
{
triple=x+y+z;
half=triple*0.5;
area=sqrt(half*(half-x)*(half-y)*(half-z));
R=area*2.0/triple;
if(x+y+z<=role)
max=area;
else if(2.0*PI*R>=role)
max=role*role/(4.0*PI);
else
{
r=(triple-role)/(triple/R-2.0*PI);
max=area+PI*r*r-(r*r*area/(R*R));
}
cout<<"Case "<<hujk++<<": ";
cout<<setiosflags(ios::fixed)<<setprecision(2)<<max<<endl;
cin>>x>>y>>z>>role;
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator