|
|
back to boardWA # 2 ! What's wrong ? #include <math.h> #include <stdio.h> #define PI 3.1415926535 int main() { double R,a,S,t; scanf("%lf%lf", &a, &R); t = sqrt(2.0)*a; if( R < (a/2.0) ) { S = PI*R*R; } if( R >= t/2.0 ) { S = a*a; } if( R < t/2.0 ) { S = PI*R*R - 4*( acos( a/(2.0*R) )*R*R - R*R*sin( 2*acos( a/(2.0*R) ) )/2.0); } printf("%.3lf\n", S); return 0; } Re: WA # 2 ! AC. I had to "return" and "printf" in each "if"... Edited by author 27.04.2010 23:34 Edited by author 27.04.2010 23:34 Re: WA # 2 ! Or maybe just use if ... else ... if else? |
|
|