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

哪里有问题啊?

Posted by Sunhongjian at 2010-11-28 11:34:59 on Problem 3100
#include<stdio.h>
int s(int n,int x)
{
	int l,k;
	k=n;
	for(l=1;l<x;l++)
		n*=k;
	return n;
}
int main()
{
	int a,b,n,i=1,p,q;
	scanf("%d%d",&a,&n);
	while(a!=0&&n!=0)
	{

	while(s(i,n)<a)
	{	i++;}
	p=s(i,n);
	q=s(i-1,n);
	if(p-a<a-q)
		printf("%d\n",i);
	else
		printf("%d\n",i-1);
	scanf("%d%d",&a,&n);

	}


}

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