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:算法好象可以,只是少了一行

Posted by huicpc39 at 2005-08-11 01:18:22 on Problem 2546
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;}//&Iacute;&acirc;&Agrave;&euml;&raquo;??&Iuml;??&Ccedil;&ETH;
        if(c<=a-b){area=3.1415926*b*b;goto out;}//&Auml;&Uacute;&ordm;&not;
        A=acos((b*b+c*c-a*a)/2/b/c);//&Iuml;??&frac12;&raquo;
        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