Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:我这个为什么是WA啊(好像少考虑了一种情况,仅供参考)

Posted by hujk2008 at 2004-10-19 21:01:13 on Problem 1927
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator