POJ 2109

 1 #include<iostream>
 2 #include<stdio.h>
 3 #include<math.h>
 4 using namespace std;
 5
 6 int main()
 7 {
 8     //freopen("acm.acm","r",stdin);
 9     long double num;
10     long double k;
11     while(cin>>num>>k)
12     {
13         cout<<pow(k,1.0/num)<<endl;
14     }
15 }
时间: 2024-12-10 20:46:27

POJ 2109的相关文章

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

POJ 2109 -- Unix ls

 POJ 2109 -- Unix ls Sample Input 10 tiny 2short4me very_long_file_name shorter size-1 size2 size3 much_longer_name 12345678.123 mid_size_name 12 Weaser Alfalfa Stimey Buckwheat Porky Joe Darla Cotton Butch Froggy Mrs_Crabapple P.D. 19 Mr._French Jod

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 / 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 = 高精度整数

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

Power of Cryptography - poj 2109

Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 20351   Accepted: 10284 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

POJ 2109 巧妙解法

Int最大是10^9.所以一般思路是二分+高精度.但是double 范围是10^(-307)-10^308所以可以用double型.k^n=p.所以有k=p^(1/n). 见代码: #include<stdio.h>#include<string.h>#include<iostream>using namespace std;#include<math.h> int main(){     double n, p;     while(cin >>

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题目分类推荐 (很好很有层次感)

著名题单,最初来源不详.直接来源:http://blog.csdn.net/a1dark/article/details/11714009 OJ上的一些水题(可用来练手和增加自信) (POJ 3299,POJ 2159,POJ 2739,POJ 1083,POJ 2262,POJ 1503,POJ 3006,POJ 2255,POJ 3094) 初期: 一.基本算法: 枚举. (POJ 1753,POJ 2965) 贪心(POJ 1328,POJ 2109,POJ 2586) 递归和分治法. 递