poj 2109

    xiaoxiao2021-03-26  24

                           

     

     POJ - 2109    Power of Cryptography        比赛时,一看到这种题,觉得数这么大,就想用大数,然后用log,但是计算过程中,k的值不断被精确,导致最后的精确度差距很大,后来看了一些题解,谈到了范围问题: 类型          长度 (bit)                  有效数字                        绝对值范围 float             32                      6~7                   10^(-37) ~ 10^38 double          64                     15~16                10^(-307) ~10^308 long double   128                   18~19                10^(-4931) ~ 10 ^ 4932 才知道,double范围这么大,并且题目也没有我想象的这么复杂 #include<cstdio> #include<iostream> #include<cmath> using namespace std; int main() { double n,p; while(scanf("%lf%lf",&n,&p)!=EOF) cout<<pow(p,1.0/n)<<endl; return 0; }

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

    最新回复(0)