POJ - 2109

xiaoxiao2021-02-28  48

看到1<=p<10101 我就去想大数操作了,后来看了discuss原来double完全可以放。

类型          长度 (bit)           有效数字          绝对值范围float             32                      6~7                  10^(-37) ~ 10^38double          64                     15~16               10^(-307) ~10^308long double   128                   18~19                10^(-4931) ~ 10 ^ 4932

接下来就是直接用pow(n,1/p)就可以了。

Sample Input

2 16 3 27 7 4357186184021382204544Sample Output 4 3 1234

     

       代码:

#include<stdio.h> #include<math.h> int main() { double n,p; while(~scanf("%lf%lf",&n,&p)) printf("%.lf\n",pow(p,1 / n)); return 0; }

 

转载请注明原文地址: https://www.6miu.com/read-2623665.html

最新回复(0)