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 |
求助求助! 测试数据已过 为什么总是WAa是弧对应的圆心角的一半。 #include<stdio.h> #include<math.h> const double PI=acos(-1.0); int main() { //freopen("1.txt","r",stdin); double s,max,min,mid,l,L,a,n,c; while(scanf("%lf%lf%lf",&l,&n,&c)!=EOF&&(l!=-1||n!=-1||c!=-1)) { L=(1+n*c)*l; max=PI/2,min=0; double temp; if(l==0) s=0; else { do { mid=(max+min)/2; temp=sin(mid)/mid; if(temp>l/L) min=mid; else max=mid; }while(fabs(temp-l/L)>1e-12); double r=L/2/mid; s=r-r*cos(mid); } printf("%.3lf\n",s); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator