poj2109——Power of Cryptography

标签: power poj numbers acm c
872人阅读 评论(0) 收藏 举报


Current work in cryptography involves (among other things) large prime numbers and computing powers of numbers among 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 only of theoretical interest.
This problem involves the efficient computation of integer roots of numbers.
Given an integer n>=1 and an integer p>= 1 you have to write a program that determines the n th positive root of p. In this problem, given such integers n and p, p will always be of the form k to the nth. power, for an integer k (this integer is what your program must find).

The input consists of a sequence of integer pairs n and p with each integer on a line by itself. For all such pairs 1<=n<= 200, 1<=p<10101 and there exists an integer k, 1<=k<=109 such that kn = p.

For each integer pair n and p the value k should be printed, i.e., the number k such that k n =p.
Sample Input

2 16
3 27
7 4357186184021382204544
Sample Output



#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstdio>
//#include <set>
#include <vector>
#include <iomanip>
#include <stack>
#include <map>
#include <queue>
#define MAXN 1010
#define mod 2012
#define INF 0x3f3f3f3f
using namespace std;
int main()
    double n,p;
    return 0;

POJ2109-Power of Cryptography

转载请注明出处:優YoU  http://user.qzone.qq.com/289065406/blog/1299228474 提示:一般思路:二分+高精度算法 但是本题还有一个更加巧妙的办法去处理...
  • lyy289065406
  • lyy289065406
  • 2011年07月29日 02:07
  • 7314

二分法+高精度——Poj 2109 Power of Cryptography(double型开n次方的方法通过的原因)

Power of Cryptography Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 1...
  • code_pang
  • code_pang
  • 2012年12月06日 12:20
  • 4445

POJ2109 Power of Cryptography 二分

题目大意:给你两个整数n和p(1101 ),让你找出一个整数k,使n^k=p。 分析: 有两种思路: (1)看一下就可以知道,p的范围是可以用double装下的。然后我们都知道pow函数...
  • AC_Gibson
  • AC_Gibson
  • 2015年03月19日 13:11
  • 347

POJ2109:Power of Cryptography

点击打开题目链接 Language: Default Power of Cryptography Time Limit: 1000MS   Memory Limit: 30000K...
  • l383137093
  • l383137093
  • 2013年07月23日 23:30
  • 902

poj2109 Power of Cryptography

poj2109 Power of Cryptography
  • qq_34600424
  • qq_34600424
  • 2017年10月06日 11:42
  • 38

3.1 poj2109 Power of Cryptography

题目链接:http://poj.org/problem?id=2109题意分析:有指数函数 k^n=p,其中k,n,p均为整数且1&lt;=k&lt;=10^9,1&lt;=n...
  • qq_35710556
  • qq_35710556
  • 2018年02月12日 14:22
  • 8

POJ2109 Power of Cryptography

http://poj.org/problem?id=2109 题意:输入n、p,求满足k^n=p的k。 这题武大怎么归成贪心了。。。。。 #include #include #i...
  • Chromer_cn
  • Chromer_cn
  • 2012年05月04日 22:45
  • 251

Power of Cryptography POJ2109

Power of Cryptography Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 1...
  • tiantangrenjian
  • tiantangrenjian
  • 2011年09月25日 14:14
  • 675

poj2109 Power of Cryptography(数学题)

poj2109 Power of Cryptography(数学题)
  • u012860063
  • u012860063
  • 2014年07月10日 15:47
  • 1234

poj2109 Power of Cryptography(水题。。。)

Power of Cryptography Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 2...
  • luckcircle
  • luckcircle
  • 2017年02月01日 13:13
  • 155
    专栏达人 持之以恒
    访问量: 40万+
    积分: 1万+
    排名: 1779