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. vs2008 c++工程如何设置生成调试信息

    记录一个使用vs2008碰到的问题: 今天在用vs2008的时候,想封装一个lib库,建了一个c++的lib工程,后来为了测试函数功能,想偷懒就直接在工程中加了个main函数,并且把工程属性prope ...

  2. makefile missing separator. Stop

    ifneq ($(KERNELRELEASE),) obj-m := hello.o else PWD := $(shell pwd) KVER := $(shell uname -r) KDIR : ...

  3. Article Master Data Deviation

    Site data – Logistics DC / Logistics Store Where is the reference site decided when you maintain the ...

  4. 最新模仿ios版微信应用源码

    这个是刚刚从那个IOS教程网http://ios.662p.com分享来的,也是一个很不错的应用源码,仿微信基本功能.基于XMPP服务器的即时通信以及交友客户端. ----第一期代码的功能如下---- ...

  5. CCNA第三讲笔记

    TCP/IP可以分为四层或者五层 应用层.传输层.网络层.网络接口层 或者 应用层.传输层.网络层.数据链路层.物理层 与OSI相比 相同点:都有层次结构 不同点:TCP/IP的应用层包含了OSI的应 ...

  6. [DevExpress]GridControl之CustomColumnDisplayText Helper

    在实际开发中,有时候需要对GridControl中列值进行转义,譬如1转义成完成等等,一般在诸如CustomColumnDisplayText事件中能够轻松完成,为了提高代码复用性,所以对Custom ...

  7. Windows 8.1 (64bit) 下搭建 MongoDB 2.4.9 环境

    一.下载MongoDB 2.4.9版 进入MongoDB官方网站的下载页面. 找到Windows 64-bit版的下载链接进行下载. 二.安装MongoDB 2.4.9版 将下载的文件解压到任意目录. ...

  8. VB 核心编程及通用模块开发 笔记1

    前言:学习任何编程语言.编程工具的目的不外乎解决生活问题,能够快速.高效解决问题的方式就是不错的方式,至于选择什么“工具”,众位看官看着办,本人虽然有过3年vb开发经验,但是一直没有深入学习,现已购买 ...

  9. 怎样在自己的网站上做自动生成当前url的二维码

    $todoString="www.maomii.com"; generateQRfromGoogle($todoString); /** * google api 最多4296个字 ...

  10. c语言指针用法

    一.指针 int t 定义整型变量 int *p p为指向整型数据的指针变量 int a[n] 定义整型数组a,它有n个元素 int *p[n] 定义指针数组p,它由n个指向整形数据的指针元素组成 i ...