| ||||||||||
| 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 | |||||||||
Why WA? All the test datas are passed!!#include <stdio.h>
#include <math.h>
int main()
{
double m;
short flag;
long i,n,max,h;
while(scanf("%ld",&h) && h != 0)
{
flag = 1;
if(h<0)
{
h = -h;
flag = 0;
}
max = 1;
for(i=2;i<=32;i++)
{
m=pow((long double)h,1.0/i);
n=int(m);
if(m-n<1e-12||n+1-m<1e-12)
max=i<max?max:i;
if(flag == 0 && max%2 ==0)
max = max/2;
}
printf("%ld\n",max);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator