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 |
终于过了....试了一个上午的1e-5以前的数,就是没试1e-6哇........5555555555In Reply To:谁能帮帮小弟啊------~~~~~~~~~~~~5555555555555555555WA了一个早上啊?..究竟要注意什么啊?... Posted by:mythology at 2007-08-04 10:32:26 > #include <stdio.h> > #include <math.h> > > #define M 1e-5 > > int main () > { > double x,y,c,t; > > label:while(scanf("%lf%lf%lf",&x,&y,&c)==3) > { > double mid,low,high,sum; > if(x<y) > t=x,x=y,y=t; > if(c>=y) > goto label; > low=0,high=y; > do > { > mid=(low+high)/2; > sum=c/sqrt(y*y-mid*mid)+c/sqrt(x*x-mid*mid); > > if(sum>1) > high=mid; > else if(sum<1) > low=mid; > else > goto lza; > }while(fabs(sum-1)>M && low+M<high); > > lza: printf("%.3lf\n",mid); > } > } > > > 谢谢了哈.... Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator