POJ 2019 Power of Cryptography

技巧。

#include<iostream>
#include<cmath>
using namespace std;
double n,p;
int main(){
	while(cin>>n>>p){
		cout<<pow(p,1/n)<<endl;
	}
}
时间: 2024-10-08 01:29:45

POJ 2019 Power of Cryptography的相关文章

POJ - 2109 Power of Cryptography(高精度log+二分)

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

POJ 2109 Power of Cryptography

http://poj.org/problem?id=2109 题意: 给出两个数n和p,要求p是n的几次方. 思路: 好神奇的题目,我一开始想那就一直除呗,后来又想到了有pow这种公式,居然这么简短就过了,有点不可思议. 1 #include<iostream> 2 #include<cmath> 3 using namespace std; 4 5 int main() 6 { 7 double n, p; 8 while (cin >> n >> p)

POJ - 2109 - Power of Cryptography = 高精度整数

http://poj.org/problem?id=2109 给一个大概100位的高精度整数p,找他的n次方根,貌似题目有问题,不一定会有开根开得尽的情况,这个时候要找的就是最大的根. 那这样有什么意思呢? 这种题按道理要用Java去写的,可以先从p和n的关系找到根的位数,然后在这个范围里面二分会更快. 具体来说,比如22位的p,7次方根,就是22/7的上整,取4位数. 还有就是因为题目的原因,double的精度对100位的高精度整数开根是足够的,也就是不会的话可以试试莽一发long doubl

Poj 2109 / OpenJudge 2109 Power of Cryptography

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 (

POJ 2109 :Power of Cryptography

Power of Cryptography Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 18258   Accepted: 9208 Description Current work in cryptography involves (among other things) large prime numbers and computing powers of numbers among these primes. W

poj2109 Power of Cryptography(数学题)

题目链接:http://poj.org/problem?id=2109 Description 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 num

Power of Cryptography(用double的泰勒公式可行分析)

Power of Cryptography Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=99&page=show_problem&problem=49 http://poj.org/problem?id=2109 Time Limit: 1000MS   Memory Limit: 30000K Total Su

POJ_2109 Power of Cryptography 数学

题目链接:http://poj.org/problem?id=2109 参考链接:http://blog.csdn.net/synapse7/article/details/11672691 乍一看似乎高精度,但是double足矣.....15位有效数字, 指数范围-307~308(10位基数) 代码: 1 int main(){ 2 double n, p; 3 while(scanf("%lf %lf", &n, &p) == 2){ 4 double k = po

POJ 1459 Power Network(网络流 最大流 多起点,多汇点)

Power Network Time Limit: 2000MS   Memory Limit: 32768K Total Submissions: 22987   Accepted: 12039 Description A power network consists of nodes (power stations, consumers and dispatchers) connected by power transport lines. A node u may be supplied