#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main()
{
vector<int> jg;
while(1)
{
int a,b;
cin>>a>>b;
if((a==0)&&(b==0))
{
break;
}
int i=1;
int min=a;
int jl=1;
while(1)
{
int cha;
if(a>pow(i,b))
{
cha=a-pow(i,b);
}else
{
cha=pow(i,b)-a;
}
if(cha<min)
{
min=cha;
jl=i;
}else
{
break;
}
i++;
}
jg.push_back(jl);
}
for(int i=0;i<jg.size();i++)
{
cout<<jg[i]<<endl;
}
return 0;
}
转载请注明原文地址: https://ju.6miu.com/read-972132.html