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 ;
}

最新文章

  1. iOS 保存、读取与应用状态
  2. 系统安装LOL等游戏后出现VS调试报错&quot;无法调试&quot;&quot;拒绝访问&quot;之类的调试错误
  3. 删除自带OpenJDK
  4. select resharper shortcuts scheme
  5. XML通過XSD產生CLASS
  6. 基于NPOI的Execl导入导出例子
  7. EXTJS 资料 Ext.Ajax.request 获取返回数据
  8. c#中jeson字符串和OBJECT对象的相互转换
  9. Java学习----对象的状态和行为
  10. oracle group by 使用
  11. zzu--2014年11月16日月潭赛 B称号
  12. ios save image to album
  13. Hadoop学习之Ubuntu12.04 Hadoop 环境搭建笔记
  14. 使用多个DNS供应商以缓解DDoS攻击
  15. 【转】请求处理机制其二:Django中间件的解析
  16. 【前端童鞋看过来!】给大家分享网盘里前端相关书籍,主要是和网络通信(HTTP/TCP/IP)及javascript相关的
  17. Unity协程的坑
  18. 使用ffmpeg视频切片并加密
  19. ASP.NET -- WebForm -- Session的使用
  20. js-循环中判断两次点击是否是同一元素

热门文章

  1. JetBRAINS 系列注册机
  2. java 枚举 类 enum
  3. JavaScript之this,new,delete,call,apply
  4. Python执行效率测试模块timei的使用方法与与常用Python用法的效率比较
  5. 1020. Tree Traversals (序列建树)
  6. Oracle的rownum原理
  7. DataGridView控件-学习笔记总结
  8. There is a legend about a bird
  9. 九度OJ - 题目1481:Is It A Tree?
  10. iOS 通览(二)