| ||||||||||
| 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 了 一下午 是在是不知道哪错了。。。。。。 Posted by:muyue at 2008-08-15 15:04:15 > #include<stdio.h>
> #include<string.h>
> #include<math.h>
> #define pi 3.14159265358
> int main(){
> int i,j,k,m,n;
> double x1,y1,r1,x2,y2,r2,r,r3,s,area;
> double A,B;
> while(scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&r1,&x2,&y2,&r2)!=EOF){
> r=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
> if(r1<r2)
> { r3=r1;
> r1=r2;
> r2=r3;}
> // printf("r1==%.3lf r2==%.3lf r=%.3lf\n",r1,r2,r);
> if(r>=r1+r2)
> printf("0.000\n");//相离或相切
> else if(r<=r1-r2){
> printf("%.3lf\n",pi*r2*r2);
> }
> else {
> A=acos((r1*r1+r*r-r2*r2)/(2*r1*r));
> B=acos((r2*r2+r*r-r1*r1)/(2*r*r2));
> s=(r1+r2+r)/2;
> s=sqrt(s*(s-r1)*(s-r2)*(s-r));
> area=A*r1*r1+B*r2*r2-2*s;
>
> printf("%.3lf\n",area);
> }
> }
>
> return 0;
> }
>
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator