ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1084. Goat in the Garden

who can tell me why WA?
Posted by silentfish 20 Apr 2002 17:42
#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);
}
....
Posted by LiangHonghao 20 Apr 2002 17:59
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?
Posted by ECUST Multistar 23 May 2002 16:52
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
Posted by young master 22 May 2004 22:53
ok,i havent seen your prog clearly