uva 113 Power of Cryptography

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main()
{
    int n;
    double p;
    while(cin >> n >> p)
    {
        printf("%.0f\n",pow(p,1.0/n));
    }
}
时间: 2024-10-21 12:09:23

uva 113 Power of Cryptography的相关文章

UVA 113 Power of Cryptography (数学)

Power of Cryptography  Background Current work in cryptography involves (among other things) large prime numbers and computing powers of numbers modulo functions of these primes. Work in this area has resulted in the practical use of results from num

UVA - 113 Power of Cryptography (大数幂+二分)

打开链接 给定n和p,找出 k使得  k^n==p .1<=k<=10^9 我们可以二分k,用高精度表示出k^n 然后跟p比较. #include<cstdio> #include<cmath> #include<cstring> const int maxn = 1000000000; struct bign { int len; int f[1500]; bign() {memset(f,0,sizeof(f)); len=0;} }; int n,an

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

Power of Cryptography Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=99&page=show_problem&problem=49 http://poj.org/problem?id=2109 Time Limit: 1000MS   Memory Limit: 30000K Total Su

UVa 10298 - Power Strings

题目:求一个串的最大的循环次数. 分析:dp,KMP,字符串.这里利用KMP算法. KMP的next函数是跳跃到最近的串的递归结构位置(串元素取值0 ~ len-1): 由KMP过程可知: 如果存在循环节,则S[0 ~ next[len]-1] 与 S[len-next[len] ~ len-1]相匹配: 则S[next[len] ~ len-1]就是循环节(且最小),否则next[len]为0: 因此,最大循环次数为len/(len-next[len]),最小循环节为S[next[len] ~

poj2109 Power of Cryptography(数学题)

题目链接:http://poj.org/problem?id=2109 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 num

UVA 11149 - Power of Matrix(矩阵倍增)

UVA 11149 - Power of Matrix 题目链接 题意:给定一个n*n的矩阵A和k,求∑kiAi 思路:利用倍增去搞,∑kiAi=(1+Ak/2)∑k/2iAi,不断二分即可 代码: #include <cstdio> #include <cstring> const int N = 45; int n, k; struct mat { int v[N][N]; mat() {memset(v, 0, sizeof(v));} mat operator * (mat

poj2109(Power of Cryptography)

神水. 求n=log(k p)-> k=pow(p,1/n). G++和C++输出不同,编译器原因. 代码: 1 #include<cstdio> 2 #include<cmath> 3 #include<cstring> 4 #include<iostream> 5 #include<algorithm> 6 7 using namespace std; 8 9 int main() 10 { 11 double n,p; 12 whil

UVA - 10298 Power Strings (KMP求字符串循环节)

Description Problem D: Power Strings Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplication, exponentiati

POJ2109——Power of Cryptography

Power of Cryptography DescriptionCurrent 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