UVA113 - Power of Cryptography
来源:互联网 发布:ug数控车床编程视频 编辑:程序博客网 时间:2024/05/28 15:41
Power of Cryptography
Background
Current work in cryptography involves (among other things) large prime numbers and computing powers of numbers modulo functions of these primes. Work in this area has resulted in the practical use of results from number theory and other branches of mathematics once considered to be of only theoretical interest.
This problem involves the efficient computation of integer roots of numbers.
The Problem
Given an integer and an integer you are to write a program that determines , the positive root of p. In this problem, given such integers n and p, p will always be of the form for an integer k (this integer is what your program must find).
The Input
The input consists of a sequence of integer pairs n and p with each integer on a line by itself. For all such pairs , and there exists an integer k, such that .
The Output
For each integer pair n and p the value should be printed, i.e., the number k such that .
Sample Input
21632774357186184021382204544
Sample Output
431234
不是说好的10的101次方吗?为什么一个double就能过啊?!!!!!!
#include <iostream>#include <cstdio>#include <cmath>using namespace std;int main(){ int k,n; double p; while(~scanf("%d",&n)) { scanf("%lf",&p); k=int(pow(p,1.0/n)+0.5); printf("%d\n",k); } return 0;}
Power of Cryptography
Background
Current work in cryptography involves (among other things) large prime numbers and computing powers of numbers modulo functions of these primes. Work in this area has resulted in the practical use of results from number theory and other branches of mathematics once considered to be of only theoretical interest.
This problem involves the efficient computation of integer roots of numbers.
The Problem
Given an integer and an integer you are to write a program that determines , the positive root of p. In this problem, given such integers n and p, p will always be of the form for an integer k (this integer is what your program must find).
The Input
The input consists of a sequence of integer pairs n and p with each integer on a line by itself. For all such pairs , and there exists an integer k, such that .
The Output
For each integer pair n and p the value should be printed, i.e., the number k such that .
Sample Input
21632774357186184021382204544
Sample Output
431234
不是说好的10的101次方吗?为什么一个double就能过啊?!!!!!!
#include <iostream>#include <cstdio>#include <cmath>using namespace std;int main(){ int k,n; double p; while(~scanf("%d",&n)) { scanf("%lf",&p); k=int(pow(p,1.0/n)+0.5); printf("%d\n",k); } return 0;}
Power of Cryptography
Power of Cryptography
Background
Current work in cryptography involves (among other things) large prime numbers and computing powers of numbers modulo functions of these primes. Work in this area has resulted in the practical use of results from number theory and other branches of mathematics once considered to be of only theoretical interest.
This problem involves the efficient computation of integer roots of numbers.
The Problem
Given an integer and an integer you are to write a program that determines , the positive root of p. In this problem, given such integers n and p, p will always be of the form for an integer k (this integer is what your program must find).
The Input
The input consists of a sequence of integer pairs n and p with each integer on a line by itself. For all such pairs , and there exists an integer k, such that .
The Output
For each integer pair n and p the value should be printed, i.e., the number k such that .
Sample Input
21632774357186184021382204544
Sample Output
431234
#include <iostream>#include <cstdio>#include <cmath>using namespace std;int main(){ int k,n; double p; while(~scanf("%d",&n)) { scanf("%lf",&p); k=int(pow(p,1.0/n)+0.5); printf("%d\n",k); } return 0;}
- UVA113 - Power of Cryptography
- UVa113 Power of Cryptography
- A - Power of Cryptography uva113
- Power of Cryptography POJ2109
- JOJ1728:Power of Cryptography
- poj21029 Power of Cryptography
- POJ2109 Power of Cryptography
- 113 - Power of Cryptography
- UVa Power of Cryptography
- 113 - Power of Cryptography
- F - Power of Cryptography
- uva Power of Cryptography
- POJ2109--Power of Cryptography
- Power of Cryptography
- 113 - Power of Cryptography
- 113 - Power of Cryptography
- 113 - Power of Cryptography
- poj2109-Power of Cryptography
- 我的不靠谱择业[饮水思源feeling]
- 《保卫萝卜2》成功背后的思考
- 个人站长需要具备的知识,可以说是一个完整的知识框架
- STL的deque类
- linux deepin下安装JDK和安装tomcat
- UVA113 - Power of Cryptography
- excel中数字直接转换为中文大写
- 学习笔记 VS2005内存泄露检查(网络转载)
- 关于btrfs的修复,恢复数据
- 办理icbc的网银
- STL list
- php缺少mysql模块解决方案
- HDU1875畅通工程之最小生成树——kruskal
- VTK中通过vtkCommand定义用户方法在其他vtkRenderWindow显示