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:算法好象可以,只是少了一行In Reply To:哪位帮我看看,wa了10次了,真不知道还有什么没考虑到 Posted by:radish at 2005-08-10 18:03:14 #include<iostream> #include<math.h> #include<iomanip> using namespace std; int main() { double x1,y1,a,x2,y2,b,c,s,A,B,area; while(cin>>x1>>y1>>a>>x2>>y2>>b) { if(a<b)c=a,a=b,b=c; c=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); if(c>=a+b){area=0;goto out;}//ÍâÀë»??Ï??ÇÐ if(c<=a-b){area=3.1415926*b*b;goto out;}//ÄÚº¬ A=acos((b*b+c*c-a*a)/2/b/c);//Ï??½» B=acos((a*a+c*c-b*b)/2/a/c); s=(a+b+c)/2; s=sqrt(s*(s-a)*(s-b)*(s-c)); area=a*a*B+b*b*A-2*s; out: cout<<setiosflags(ios::fixed)<<setprecision(3)<<area<<endl; } return 1; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator