|
|
back to boardwho can tell me why WA? #include<stdio.h> #include<math.h> void main() { double a,b,s; scanf("%lf%lf",&a,&b); if((a==0)||(b==0)){ s=0; printf("%.3lf",s); return; }else if(b-1.4142*a>=1e-4){ s=a*a; }else if(b-a/2<=1e-4){ s=3.1416*b*b; }else{ double alfa=2*acos(a/(2*b)); double s1=b*b*alfa/2-b*b*sin(alfa)/2; s=3.1416*b*b-4*s1; } printf("%.3lf\n",s); } .... I think there is something error in the math.h of this problem. So I had to use integral to do it. :( Re: who can tell me why WA? Can you use Dephi??????????? Or Pascal...... It's more easy to slove this problem. maybe you should pay some attention to that there's totally 3 cases ok,i havent seen your prog clearly |
|
|