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

anyone can tell me what's wrong?
Posted by mon 3 Feb 2002 02:36
thanks...

#include <stdio.h>
#include <math.h>

#define PI 3.1416

int main()
{
        double a, r, area;

        scanf("%lf%lf", &a, &r);
        a /= 2;

        if (a >= r) {
                printf("%.3f\n", PI * r * r);
                return 0;
        }
        if (r >= sqrt(2) * a) {
                printf("%.3f\n", 4 * a * a);
                return 0;
        }
        printf("%.3f\n", PI * r * r - 4 * (acos(a / r) * r * r - a *
sqrt(r * r - a * a)));
        return 0;
}
I don't know whether <math.h> is allowed,but you can...
Posted by Song Chao (ECUST Mutistar) 24 Feb 2002 08:09
> thanks...
>
> #include <stdio.h>
> #include <math.h> ??????

You can use integral to calculate the area Instead of using any
mathematic function.
I got the answer
Posted by mon 3 Apr 2002 12:33
I should use ".3lf" instead of ".3f" in the format string
of printf.
but was that AC???
Posted by silentfish 20 Apr 2002 17:43
> I should use ".3lf" instead of ".3f" in the format string
> of printf.
Re: anyone can tell me what's wrong?
Posted by 8P 14 Feb 2010 22:53
#define PI 3.1416 // no
#define PI 3.1415926535897932 //yes
Re: anyone can tell me what's wrong?
Posted by oybek 17 May 2014 17:54
Better to use standard M_PI

Edited by author 17.05.2014 17:54