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

水题直接贴代码,暴力都0ms

Posted by TSERROF at 2012-08-26 10:37:58 on Problem 3100
#include<cstdio>
int N,B;
int exponentiation(int x)
{
	int ans=x;
	if(x==1)return 1;
	for (int i=N;i!=1;--i)
		ans*=x;
	return ans;
}
int main()
{
	while(scanf("%d%d",&B,&N)!=EOF)
	{
		if(N==0 && B==0)break;
		int A=1,ans;
		int result=exponentiation(A);
		while(result<B)
		{
			++A;
			result=exponentiation(A);
		}
		if(result-B<B-exponentiation(A-1))printf("%d\n",A);
		else printf("%d\n",A-1);
	}
	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