【转】http://blog.csdn.net/zxy_snow/article/details/6036148
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <math.h>
using namespace std;
int main(void)
{
double b,n,temp;
while( cin >> b >> n && b && n )
{
temp = pow(b,1/n);
int x = (int)temp;
int y = (int)(temp+0.5);
if( b - pow(x,n) > pow(y,n) - b )
cout << y << endl;
else
cout << x << endl;
}
return 0;
}