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 |
终于AC了 本来是前2样例对的但是第3个错了 后来发现果然是精度问题 然后参考了别人的代码用了求根公式就对了#include<stdio.h> #include<math.h> int main(){ double x,y,ka,c,m,n; while(scanf("%lf%lf%lf%lf",&ka,&c,&m,&n)!=EOF){ if(ka==0&&c==0&&m==0&&n==0) break; x=sqrt(ka*ka+4*m*n*c*ka); y=(-ka+x)/(2*m*n); printf("%.3lf\n",-log10(y*m)); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator