113

一开始没想到什么好的方法,一看数据那么大,感觉得用大数,但又不会写大数。只能看别人怎么做的了。

发现一个极好的东西,pow函数可以对浮点型运算,所以只需读入时按照浮点型读入,输出时不输出小数部分即可,

完全用不上大数。。。。直接无语了。。。

#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

double n, p;

int main()
{
    while(scanf("%lf%lf", &n, &p)!=EOF)
    {
        printf("%.0lf\n", pow(p, 1.0/n));
    }
    return 0;
}

posted @ 2011-05-13 01:11  KOKO's  阅读(172)  评论(0)    收藏  举报