RSS
![Table_bottom](/images/table_bottom.jpg?1375031774)
linjiazhen
![Avatar](/user_files/linjiazhen/config/avatar.png?1375032418)
![Table_bottom](/images/table_bottom.jpg?1375031774)
分类
![Table_bottom](/images/table_bottom.jpg?1375031774)
标签云
![Table_bottom](/images/table_bottom.jpg?1375031774)
搜索
![Table_bottom](/images/table_bottom.jpg?1375031774)
随机文章
![Table_bottom](/images/table_bottom.jpg?1375031774)
最新评论
![Table_bottom](/images/table_bottom.jpg?1375031774)
最新留言
![Table_bottom](/images/table_bottom.jpg?1375031774)
链接
![Table_bottom](/images/table_bottom.jpg?1375031774)
计数器
145643
![Table_bottom](/images/table_bottom.jpg?1375031774)
UVA 113: Power of Cryptography
Jasonlin
posted @ 2011年3月28日 10:49
in UVA
, 2727 阅读
题目大意:
一个数k的n次方等于p,给你n和p求出k。 ,
。
解题思路:
看到数据范围吓到了,难道是高精度?难度要用JAVA高精度?才头几题有必要这么可怕?后来实在不行了,看解题报告,看一下吐血,float的范围为-2^128 ~ +2^127,也即-3.40E+38 ~ +3.40E+38;double的范围为-2^1024 ~ +2^1023,也即-1.79E+308 ~ +1.79E+308。所以只要用double和pow就行~还用了下C++精度控制。
解题代码:
#include<iostream> #include<iomanip> #include<cmath> using namespace std; int main(){ double n,p; while(cin>>n>>p){ cout<<fixed<<setprecision(0)<<pow(p,1/n)<<endl; } return 0; }