Sunday, February 27, 2011

113 - Power of Cryptography


#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
long round(long double x);
int main()
{
    long double p,k;
    long int root,n;
//    freopen("in.txt","r",stdin);
    while(scanf("%ld%Lf",&n,&p)==2)
    {
        k=exp(log(p)/n);
        root=round(k);
        printf("%ld\n",root);
    //    printf("%Lf\n",k);
    }
    exit(0);
}
long round(long double x)
{
    long int y,z;
    z=floor(x);
    if(x-z>=0.5)
        y=z+1;
    else
        y=z;
    return y;
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.