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 gemenhao at 2006-03-17 18:15:09 on Problem 1730
#include<stdio.h>
#include<math.h>
#define zero 1e-6
typedef long long l64;
int powb(l64 t,l64 x)
{
	if(2==t%4)
		return 1;
	int b=2,p=1,a=1;
	if(t%5==2||t%5==3||x<0)
		a=2;
	for(int i=a+1;b>1;i+=a)
	{
		b = (int)(pow(t,1.0/i)+zero);
		if(fabs(pow(b,i)-t)<zero)
			p = i;
	}
	return p;
}

int main()
{
	l64 x;
	while(scanf("%I64d",&x) && x)
		printf("%d\n",powb(x>0?x:-x,x));
	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