| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
我也提供代码 多谢前面那位提供代码的兄弟#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator