113 - Power of Cryptography

题目原文:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=49

输入两个数n,p,计算k=tex2html_wrap_inline36....但是注意取值范围。略大啊,但是注意到Double是可以保存的额。。。就是精度不高,但是够了。。。

第一次做的时候脑抽了。。。没想到开n次方根直接可以1/n次方。。。好吧我无语了。

 1 #include<stdio.h>
 2 #include<math.h>
 3 int main()
 4 {
 5     double n,p;
 6     while(scanf("%lf%lf",&n,&p)!=EOF)
 7     {
 8         printf("%d\n",(int)(pow(p,1.0/n)+0.5));
 9     }
10     return 0;
11 }
View Code

 

posted on 2013-05-26 00:53  T^T  阅读(95)  评论(0编辑  收藏  举报

导航