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 |
UP~In Reply To:崩溃(G++死活不过)谁知道问题出在哪里??!! Posted by:B06350214 at 2008-08-18 17:19:57 > #include<stdio.h> > #include<string.h> > #include<math.h> > double INF; > > double ll; > double find(double len) > { > double r = INF, l = 0; > double mid, tmp; > int i; > //while(fabs(r-l) > 1e-12) > for(i = 0; i < 100; i++) > { > mid = (l+r)/2; > tmp = 2*mid*asin(len/2/mid); > //printf("%lf\n", tmp); > if(fabs(tmp-ll) < 1e-12) return mid; > else if(tmp < ll) > r = mid; > else l = mid; > } > return 0; > } > > > int main() > { > double l, t, c; > double tmp; > INF = 400000000; > INF *= INF; > while(scanf("%lf %lf %lf", &l, &t, &c) != EOF && fabs(l+1) > 1e-12) > { > if(fabs(l) < 1e-12){ printf("0.000\n"); continue; } > ll = (1+t*c)*l; > tmp = find(l); > printf("%.3lf\n", tmp-sqrt(tmp*tmp-l*l/4)); > } > return 0; > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator