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

Why CE?
Posted by Denis 12 Sep 2007 18:56
I have no idea why I have CE on this solution. Can anyone help me?

#include <iostream>
#include <stdio.h>
#include <math.h>
#include <algorithm>
using namespace std;

long double eps = 1e-4;

int main ()
{
    double r, l, sq;
    cin>>l>>r;
    if (2*r <= l)
    {
        sq = M_PI*r*r;
    }
    else if (l*l <= 2*r*r)
    {
        sq = l*l;
    }
    else
    {
        double cs = (l/2)/r, angle;
        angle = acos (cs);
        sq = r*l/2*sin (angle);
        angle *= 8, sq *= 4;
        double sq2 = (2*M_PI-angle)*r*r/2;
        if (sq2 < eps)
        {
            sq -= sq2;
        }
        else
        {
            sq += sq2;
        }
    }
    printf ("%.3lf", sq);
    return 0;
}
Re: Why CE?
Posted by Kholdi 9 Jan 2008 19:43
It was my problem too.
just use 3.1415... instead of M_PI.
M_PI is not declared for the INTEL compiler.