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

哪位帮我看看,wa了10次了,真不知道还有什么没考虑到

Posted by radish at 2005-08-10 18:03:14 on Problem 2546
#include<iostream.h>
#include<math.h>
#include<iomanip.h>
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:
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