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

help!!!!

Posted by 00448176 at 2005-04-26 21:26:12 on Problem 1730
//1730

#include < iostream.h >
#include < math.h >

int main()
{
	double a;
	double i;
	while(1){
		cin>>a;
		if(a==0)return 0;
//		if(a==)
		if(a>=0){
		for( i = 32;i>1;i--)
		{
			double x = pow(a,(1/i));
			if( fabs(x-floor(x))<=0.0000000000001)
				break;
			if( fabs(ceil(x)-x)<=0.0000000000001)
				break;
		}
		cout<<i<<endl;
		}
		else{
		for( i = 31;i>1;i-=2)
		{
			double x = pow(-a,(1/i));
//			cout<<x<<endl;
			if( fabs(x-floor(x))<=0.0000000000001)
				break;
			if( fabs(ceil(x)-x)<=0.0000000000001)
				break;
		}	
		cout<<i<<endl;
		}
	}
	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