UVA 113 Power of Cryptography

原来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;
}

 

你可能感兴趣的:(Cryptography)