|  | 
|  | 
| back to board | Why CE? Posted by Denis  12 Sep 2007 18:56I 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:43It was my problem too.just use 3.1415... instead of M_PI.
 M_PI is not declared for the INTEL compiler.
 | 
 | 
|