原来double可以存储比__int64更大的数

(int)(pow(p, 1.0/n) + 0.5)

CODE:

 

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

int main()
{
    double n, p;
    while(~scanf("%lf%lf", &n, &p))
    {
        double ans = (int)(pow(p, 1.0/n)+0.5);
        printf("%.lf\n", ans);
    }
    return 0;
}

 

posted on 2012-09-22 18:01  有间博客  阅读(138)  评论(0编辑  收藏  举报