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

{C++} Why wrong????
Posted by Edward Sarkisyan RAU 14 May 2007 23:30
#include<iostream.h>
#include<math.h>
int main()
{
    double pi;
    double l, r,alpha,segm,treug,delta;
    cin>>l>>r;
    pi=3;
    l/=2;
    if(r<=l/2)
        cout<<pi*r*r;
    if(r>(l*sqrt(2)))
        cout<<l*l*4;
    else
    {
        alpha=2*acos(l/r);
        segm=pi*r/(2*alpha);
        treug=l*sqrt(((r*r)-(l*l)));
        delta=segm-treug;
        cout<<pi*r*r-4*delta;
    }
    return 0;
}
Re: {C++} Why wrong????
Posted by Edward Sarkisyan RAU 14 May 2007 23:32
Sorry pi=3,145
Why when inpus is:
3 1
Output is:
-1.#IND
???
Compiler:
Visual C++ 6.0