点击打开链接

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. Jenkins初探

    最近搞搞接口测试,Postman脚本搞好了,但是每次都要手动运行,是不是太low了?Yes,it is. 最近好多人都在用Jenkins搞自动化部署集成之类的,我也凑热闹搞一下. 前提: 1. 已经安 ...

  2. 当当网开源Dubbox,扩展Dubbo服务框架支持REST风格远程调用

    当当网近日开源了Dubbox项目,可为Dubbo服务框架提供多项扩展功能,包括REST风格远程调用.Kryo/FST序列化等等. 当当网架构部和技术委员会架构师沈理向InfoQ中文站介绍了Dubbox ...

  3. 【性能诊断】九、并发场景的性能分析(windbg案例,Fist Chance Exception/Crash dump)

          经常会碰到这样的场景,自测及单单点的测试时没有任何问题,但在并发环境或生产环境下有时出现没规律的异常.报错等情况.在代码中增加日志是其中一种解决方式:抓取指定异常时的dump,通过wind ...

  4. 局域网怎么通过IP查看对方MAC

    在cmd命令状态查输 入:nbtstat -a IPIP地址就是你所需要查询的IP地址,如192.168.1.200,效果如下图:

  5. Android 使用Telephony API

    Android 使用Telephony API public class TelephonyDemo extends Activity { TextView textOut; TelephonyMan ...

  6. C#限制程序只能运行一個实例 (防多开)

    //方法一:只禁止多个进程运行 using System; using System.Collections.Generic; using System.Windows.Forms; namespac ...

  7. rails里routes配置文件里的resources和resource的区别

    抄自 http://stackoverflow.com/questions/11356146/difference-between-resource-and-resources-in-rails-ro ...

  8. gcc中动态库和静态库的链接顺序

    so文件:动态库a文件: 静态库exe文件:可执行程序(linux下以文件属性来标示是否是可执行文件,与后缀名无关) 经过自己写的一些测试程序,大致了解了下gcc中链接顺序问题,总结出以下几点:1,动 ...

  9. ROM, RAM, Flash Memory

    ROM Read-only memory (ROM) is a class of storage medium used in computers and other electronic devic ...

  10. C4.5决策树算法概念学习

    数据挖掘一般是指从大量的数据中自动搜索隐藏于其中的有着特殊关系性的信息的过程. •分类和聚类 •分类(Classification)就是按照某种标准给对象贴标签,再根据标签来区分归类,类别数不变. • ...