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<stdio.h> #include<math.h> double x; int main(void) { scanf("%lf",&x); while(x) { int i; int flag=0; int max=0; if(x<0) { x=-x; flag=1; } int shangjie=sqrt(x); if(flag==0) { for(i=1;i<=shangjie;i++) { double linshi; int h; linshi=pow(x,1/(double)i); h=(int)(linshi+1e-12); if(linshi+1e-12>h&&linshi-1e-12<h) { if(i>max) max=i; } } } else { for(i=1;i<=shangjie;i=i+2) { double linshi; int h; linshi=pow(x,1/(double)i); h=(int)(linshi+1e-12); if(linshi+1e-12>h&&linshi-1e-12<h) { if(i>max) max=i; } } } printf("%d\n",max); scanf("%lf",&x); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator