|
|
вернуться в форумWhy I got CE?(my code) #include<stdio.h> #include<math.h> #define pi 3.14159265 int main() { int l,r; double result,angle; scanf("%d%d",&l,&r); if((double)l-sqrt(2)*r<1e-6) result=1.0; else if((double)l/2.0-(double)r>-1e-6) result=pi*r*r/(double)(l*l); else { angle=acos(l/2.0/r); result=((pi-4*angle)*r*r+2*l*r*sin(angle))/(double)(l*l); } printf("%.3lf\n",result*100.0); return 0; } Re: Why I got CE?(my code) Послано BoRN 25 дек 2002 22:14 SO DO I : #include <stdio.h> #include <math.h> int main() { double rect,r,piedeg,area=0,theta; scanf("%lf %lf",&rect,&r); if(rect>=(r*2)){ printf("%.3lf",3.1415926535*r*r); } else if(((rect*sqrt(2))/2)<=r){ printf("%.3lf",rect*rect); } else{ rect=rect/2; theta=acos(rect/r); piedeg=(2*3.1415926535)-(8*theta); area=(piedeg*3.1415926535*r*r)/ (2*3.1415926535); area=area+(tan(theta)*rect*rect*4); printf("%.3lf",area); } return 0; } IT GOT CE , PLS HELP Why I got CE?(my code) sqrt(2)=>sqrt(2.0) ||sqrt((double) 2); |
|
|