点击打开链接

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 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).

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 1<=n<= 200, 1<=p<10101 and there exists an integer k, 1<=k<=109 such that kn = p.

Output

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

4
3
1234

给你两个数n和p,那么让你求p的根号n的结果,即k^n = p,让我们求出K的值,我是看了网上的做法才知道原来还可以这样

#include<stdio.h>
#include<math.h>
int main()
{
double a, b;
while(scanf("%lf %lf", &a, &b) != EOF)
{
printf("%g\n", pow(b, 1.0/a));
}
return 0;
}

poj 2109 Power of Cryptography的更多相关文章

  1. 贪心 POJ 2109 Power of Cryptography

    题目地址:http://poj.org/problem?id=2109 /* 题意:k ^ n = p,求k 1. double + pow:因为double装得下p,k = pow (p, 1 / ...

  2. POJ 2109 -- Power of Cryptography

    Power of Cryptography Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 26622   Accepted: ...

  3. POJ 2109 Power of Cryptography 数学题 double和float精度和范围

    Power of Cryptography Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 21354 Accepted: 107 ...

  4. poj 2109 Power of Cryptography (double 精度)

    题目:http://poj.org/problem?id=2109 题意:求一个整数k,使得k满足kn=p. 思路:exp()用来计算以e为底的x次方值,即ex值,然后将结果返回.log是自然对数,就 ...

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

    Current work in cryptography involves (among other things) large prime numbers and computing powers ...

  6. POJ 2109 Power of Cryptography【高精度+二分 Or double水过~~】

    题目链接: http://poj.org/problem?id=2109 参考: http://blog.csdn.net/code_pang/article/details/8263971 题意: ...

  7. POJ 2109 Power of Cryptography 大数,二分,泰勒定理 难度:2

    import java.math.BigInteger; import java.util.Scanner; public class Main { static BigInteger p,l,r,d ...

  8. Poj 2109 / OpenJudge 2109 Power of Cryptography

    1.Link: http://poj.org/problem?id=2109 http://bailian.openjudge.cn/practice/2109/ 2.Content: Power o ...

  9. POJ 2109 :Power of Cryptography

    Power of Cryptography Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 18258   Accepted: ...

随机推荐

  1. NPOI大数据量多个sheet导出源码(原)

    代码如下: #region NPOI大数据量多个sheet导出 /// <summary> /// 大数据量多个sheet导出 /// </summary> /// <t ...

  2. python之路之正则表达式

    匹配格式^ 匹配字符串的开头$ 匹配字符串的结尾. 除了换行符外的所有字符[...] 用来表示一组字符,,单独列出:[amk]匹配'a','m'或'k'[^..] 不在[]中的字符:[^abc]匹配除 ...

  3. Android 广播大全 Intent Action 事件

    Intent.ACTION_AIRPLANE_MODE_CHANGED; //关闭或打开飞行模式时的广播 Intent.ACTION_BATTERY_CHANGED; //充电状态,或者电池的电量发生 ...

  4. [mysql] mysql表名忽略大小写

    首先查看mysql是否区分大小写: 今天郁闷死了,在LINUX下调一个程序老说找不到表,但是我明明是建了表的,在MYSQL的命令行下也可以查到,为什么程序就找不到表呢? 后来请教了一个老师才搞定,原来 ...

  5. js/jquery 操作document对象

    一.获取对象 //js获取的是dom对象,jquery获取的是jquery对象 //jquery对象可以输出dom对象,索引方式输出dom对象,eq()[]方式输出dom对象;eq()输出jquery ...

  6. jQuery Wookmark 瀑布流布局

    瀑布流布局非常适合大量图片的展示,一改过去裁剪图片尺寸统一的排版,每张图片都能完全展示,并错落有致,让人眼前一亮. 版本: jQuery v1.4.3+ jQuery Wookmark Load v1 ...

  7. HackerRank "Vertical Rooks"

    Please note: VROOK cannot go back-ward - that leads to a simple variation to Game of Nim: just XOR. ...

  8. C语言每日一题之No.7

    今天是正式第一天在现有的世界里与自己相处,你再也没有另一个世界可以躲避了.终于要自己面对自己了,一个人要真实的面对自己的灵魂总是痛苦的.从学校到社会的环境转换,现实与理想的冲突,个人价值观和社会价值观 ...

  9. Ajax方法执行跳转或者加载操作系统报出这样错误Sys.WebForms.PageRequestManagerParserErrorException:如何让解决

    当你在代码中使用Response.Redirect();  或者Response.Write();难免会遇到Sys.WebForms.PageRequestManagerParserErrorExce ...

  10. 判断apache是否启动的脚本

    #!/bin/bashhttp=$(netstat -tunpl | awk '{printf $4 "\n"}' | grep '80$')if [ -z "$http ...