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 |
改了后还是过不了。实在不知怎么错啊?求救啊。实在想不出了#include <iostream.h> #include <stdio.h> #include <math.h> int main(void){ double x, y, c, m, n1, n2, h1, h2, c1; while(cin >> x >> y >> c){ c1 = 0; if(fabs(x-y)<0.00001){ printf("%.3lf\n",(2*sqrt((x/2)*(x/2) - c*c))); }else if(c == 0){ if(x <= y) printf("%.3lf\n",x); else printf("%.3lf\n",y); }else{ n1 = 0; n2 = 1; m = (n1 + n2)/2; while(1){ h1 = sqrt(x*x - (c/m)*(c/m)); h2 = sqrt(y*y - (c/(1-m))*(c/(1-m))); if(fabs(h1 - h2) < 0.00001) break; else{ if(h1>h2){ n2 = m; m = (m+n1)/2; } if(h1 <h2){ n1 = m; m = (m+n2)/2; } } } printf("%.3lf\n",(h1 +h2)/2+0.0005); } } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator