感慨pow函数的伟大,除此之外强调pow函数的参数为double类型,做过一道题,被坑死了,,等找到是哪个题就一起加到这里。。
代码不是我写的,,因为开始毫无思路,看了标答就不想写了,,
代码链接
附另一个链接,二分法没看,最后一句深有同感。。快速幂方法
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
double n,m,s;
while(scanf("%lf%lf",&n,&m)&&(n||m))
{
s=pow(m,1.0/n);
printf("%.0lf\n",s);
}
return 0;
}