Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为什么还是WA,我实在转不过来了.include <math.h> #define ABS(x) (((x)<0)?(-(x)):((x))) void main() { float m1,m2,a,x,y,c; double h1,h2,c1; while(scanf("%f",&x)==1) { if(scanf("%f",&y)!=1)break; if(scanf("%f",&c)!=1)break; m1=0; m2=(x<y)?(x):(y); while(1) { if(ABS(m1-m2)<0.001) { a=m1; break; } a=(m2+m1)/2; h1=sqrt(x*x-a*a); h2=sqrt(y*y-a*a); c1=(h1*h2)/(h1+h2); if(c1==c)break; else if(c<c1)m1=a; else m2=a; } printf("%.3f\n",a); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator