Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Why WA? All the test datas are passed!!

Posted by harkue at 2007-05-24 16:03:14 on Problem 1730
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator