Power of Cryptography

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

题目大意:输入k,p,输出n,使kn==p

解题思路:

    看Discuss说用double能水过 于是。。。。

    PS:据说要用到二分法+高精度 等以后有空再研究一下吧

Code:

 #include<cstdio>
#include<cmath>
int main()
{
double n,m;
while(scanf("%lf%lf",&n,&m)!=EOF)
printf("%.0lf\n",pow(m,/n));
return ;
}

POJ2109——Power of Cryptography的更多相关文章

  1. [POJ2109]Power of Cryptography

    [POJ2109]Power of Cryptography 试题描述 Current work in cryptography involves (among other things) large ...

  2. POJ-2109 Power of Cryptography(数学或二分+高精度)

    题目链接: https://vjudge.net/problem/POJ-2109 题目大意: 有指数函数 k^n = p , 其中k.n.p均为整数且 1<=k<=10^9 , 1< ...

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

    Power of Cryptography Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onli ...

  4. 贪心 POJ 2109 Power of Cryptography

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

  5. poj 2109 Power of Cryptography

    点击打开链接 Power of Cryptography Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 16388   Ac ...

  6. UVA 113 Power of Cryptography (数学)

    Power of Cryptography  Background Current work in cryptography involves (among other things) large p ...

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

  8. POJ 2109 :Power of Cryptography

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

  9. POJ 2109 -- Power of Cryptography

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

随机推荐

  1. UVa11384

    题意:给定正整数n,求把1,2,--,n中所有书都变成0的最少操作次数,每次操作可从序列中选择一个或多个整数,同时减去一个相同的正整数. 分析:如1,2,3,4,5,6, 第一步将4,5,6同时减4, ...

  2. rolling hash

    也是需要查看,然后修改,rolling hash, recursive hash, polynomial hash, double hash.如果一次不够,那就2次.需要在准备一个线段树,基本的线段树 ...

  3. excl剔除不合格数据求平均值

    excl剔除不合格数据求平均值 trimmean函数 正态分布: CONFIDENCE.NORM 函数

  4. [转载]mysql慢日志文件分析处理

    原文地址:mysql慢日志文件分析处理作者:maxyicha mysql有一个功能就是可以log下来运行的比较慢的sql语句,默认是没有这个log的,为了开启这个功能,要修改my.cnf或者在mysq ...

  5. angularjs--$watch、$watchGroup、$watchCollection含义

    angularjs的$watch.$watchGroup.$watchCollection使用方式   如果想在controller里面随时监听一个值的变化那就用$watch <p>    ...

  6. api接口通信安全性

    1.采用https协议传输数据 2.白名单.账号密码验证 3.密钥签名token 4.三次握手请求数据前,需要拿到密码才可以请求数据,否则异常

  7. mvc 之 @Html.DropDownList

    Dictionary<string, string> myDic = new Dictionary<string, string>(); myDic.Add(System.DB ...

  8. 用python实现了一下:甲乙两人互猜数字(数理逻辑)

    今天在园子里看到博客:超难面试题:甲乙两人互猜数字(数理逻辑).然后琢磨了半天,写了个Python程序实现算法,我得出来的结果是1,6或1,8或35,42的组合, 不知道是否正确,请高人指点? 下面列 ...

  9. Oracle 内核参数

    安装Oracle的时候,可以参考Oracle 的安装文档,来设置相关内核参数的值,但是有些参数的值还是需要根据我们自己的情况来进行调整.注:不同系统的参数不同,本篇针对linux. 一.Linux 系 ...

  10. flex打印图片

    <?xml version="1.0" encoding="utf-8"?><s:WindowedApplication xmlns:fx=& ...