uva156
来源:互联网 发布:淘宝买家申请售后换货 编辑:程序博客网 时间:2024/06/08 16:59
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=49
113 - Power of Cryptography
Time limit: 3.000 seconds
Background
Current work in cryptography involves (among other things) largeprime numbers and computing powers of numbers modulo functions ofthese primes. Work in this area has resulted in the practical useof results from number theory and other branches of mathematicsonce considered to be of only theoretical interest.
This problem involves the efficient computation of integer rootsof numbers.
TheProblem
Given an integer and an integer you are to write a program that determines , the positive root of p. In this problem, given suchintegers n and p, p will always be of the form for an integer k (this integer is what yourprogram must find).
TheInput
The input consists of a sequence of integer pairs n andp with each integer on a line by itself. For all such pairs , and there exists an integer k, such that .
TheOutput
For each integer pair n and p the value should be printed, i.e., the number k suchthat .
SampleInput
21632774357186184021382204544
SampleOutput
431234
这题其实是考察人的逆向思维。。。有点trick
#include<stdio.h>
#include<math.h>
int main()
{
int k,i;
double p,n;
while(scanf("%lf %lf",&n,&p)!=EOF)
{
printf("%.lf\n",pow(p,1/n));//强制转化成int的话会有误差,可以用floor试试
}
return 0;
}
- uva156
- UVA156
- uva156
- uva156
- UVA156
- UVa156
- UVa156
- uva156
- UVa156
- uva156
- UVa156 Ananagrams
- UVA156 Ananagrams
- Ananagrams uva156
- UVA156 - Ananagrams
- UVA156-Ananagrams
- UVA156-Ananagrams
- UVA156 Ananagrams
- UVA156 Ananagrams
- uva10420
- uva340
- uva10474
- uva152
- (还有一个点)uva156
- uva156
- uva621
- 如何查看网络端口被占用
- 1uva591(数学)
- uva10050
- php抓取页面的几种方式
- uva572
- uva784
- uva10004(bfs||dfs)