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 onc…
题目地址:http://poj.org/problem?id=2109 /* 题意:k ^ n = p,求k 1. double + pow:因为double装得下p,k = pow (p, 1 / n); 基础知识: 类型 长度 (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 2. 二分查找…
Power of Cryptography Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 26622   Accepted: 13301 Description Current work in cryptography involves (among other things) large prime numbers and computing powers of numbers among these primes.…
Power of Cryptography Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 21354 Accepted: 10799 Description Current work in cryptography involves (among other things) large prime numbers and computing powers of numbers among these primes. Work…
点击打开链接 Power of Cryptography Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 16388   Accepted: 8285 Description Current work in cryptography involves (among other things) large prime numbers and computing powers of numbers among these pr…
题目链接: http://poj.org/problem?id=2109 参考: http://blog.csdn.net/code_pang/article/details/8263971 题意: 给定n,p,求k使得kn=p(1≤n≤200, 1≤p<10101, 1≤k≤109) 分析: 高精度+二分~~ k的位数为p的位数除以n的向上取整,这样知道k的位数便可以在范围内二分了~注意这里的答案是向下取整~~ 代码: #include<cstring> #include<cst…
import java.math.BigInteger; import java.util.Scanner; public class Main { static BigInteger p,l,r,div; static int n; public static int cmp(BigInteger mid){ BigInteger sum=mid.pow(n); return sum.compareTo(p); } public static BigInteger calc(){ l=BigI…
题目:http://poj.org/problem?id=2109 题意:求一个整数k,使得k满足kn=p. 思路:exp()用来计算以e为底的x次方值,即ex值,然后将结果返回.log是自然对数,就是e为底计算的.换底公式 log<a>(b) = log<c>(b) / log<c>(a). float 的范围为-2^128 ~ +2^127,也即-3.40E+38 ~ +3.40E+38: double 的范围为-2^1024 ~ +2^1023,也即-1.79E+…
1.Link: http://poj.org/problem?id=2109 http://bailian.openjudge.cn/practice/2109/ 2.Content: Power of Cryptography Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 18872   Accepted: 9520 Description Current work in cryptography involves (…
题目链接: https://vjudge.net/problem/POJ-2109 题目大意: 有指数函数 k^n = p , 其中k.n.p均为整数且 1<=k<=10^9 , 1<=n<= 200 , 1<=p<10^101 给定 n 和 p ,求底数 k 思路: 一开始以为需要大数,没想到一个pow就行了,真是涨姿势 考虑到数值存储问题和精度问题,这题最直观的思路应该是使用 高精度算法 求解.    而事实上,这题也可用公式法求解,但需要一些技巧. 开方公式:k…