#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int b, n, i, tmp, tmp1, tmp2, ans;
while (cin >> b >> n)
{
if (b == 0 && n == 0) break;
for (i = 1; ; i++)
{
tmp = pow(i, float(n));
if (tmp > b)
{
tmp1 = tmp - b;
break;
}
}
tmp = pow(i-1, float(n));
tmp2 = b - tmp;
if (tmp1 > tmp2)
ans = i-1;
else
ans = i;
cout << ans << endl;
}
system("pause");
}
poj 3100 Root of the Problem
最新推荐文章于 2017-02-24 19:58:10 发布