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

我的哪里有问题呢.......(给出的数据通过)但是还是 wa

Posted by drownever at 2006-12-18 22:52:35 on Problem 3100
 #include<iostream.h>
long jc(long a,long n);
int main()
{
	long b,n;
	cin>>b>>n;
	while(b!=0&&n!=0)
	{
	 
		for(long a=0;a<=1000000;a++)
		{
			if(jc(a,n)>b)
			{
				if((b-jc(a-1,n))>(jc(a,n)-b))
				{
					cout<<a<<endl;
				}
				else 
					cout<<a-1<<endl;
				break;
			}
		
		}
		cin>>b>>n;
	}
	return 0;
}

long jc(long a,long n)
{
	long sum=1;
	for(long i=0;i<n;i++)
	{
		sum=sum*a;
	}
	return sum;
}

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