UVA 113 - Power of Cryptography

来源:互联网 发布:淘宝模特入门拍照姿势 编辑:程序博客网 时间:2024/05/18 00:03

题目大意:已知n,p,求k使得k^n=p;

分析:直接pow(p, 1.0/n),其中p定义为double型

总结:。。。没能理解。。。

代码:

#include <iostream>#include <cstdio>#include <cmath>#define exp 10e-8using namespace std;int main(){int n;double p;while (scanf("%d%lf", &n, &p) != EOF){printf("%d\n",(int)(pow(p, 1.0 / n) + 0.5));}return 0;}


原创粉丝点击