题目:http://poj.org/problem?id=2109

题意:求一个整数k,使得k满足kn=p。

思路:exp()用来计算以e为底的x次方值,即ex值,然后将结果返回。log是自然对数,就是e为底计算的。换底公式 log<a>(b) = log<c>(b) / log<c>(a)。

float 的范围为-2^128 ~ +2^127,也即-3.40E+38 ~ +3.40E+38

double 的范围为-2^1024 ~ +2^1023,也即-1.79E+308 ~ +1.79E+308

 #include<stdio.h>
#include<math.h>
int main()
{
double n,p;
while(~scanf("%lf%lf",&n,&p))
{
printf("%g\n",pow(p,1.0/n));
}
return ;
}

这题正确的算法本来应该是贪心,二分+高精度。

见博客http://www.2cto.com/kf/201212/174001.html

poj 2109 Power of Cryptography (double 精度)的更多相关文章

  1. 贪心 POJ 2109 Power of Cryptography

    题目地址:http://poj.org/problem?id=2109 /* 题意:k ^ n = p,求k 1. double + pow:因为double装得下p,k = pow (p, 1 / ...

  2. POJ 2109 Power of Cryptography 数学题 double和float精度和范围

    Power of Cryptography Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 21354 Accepted: 107 ...

  3. POJ 2109 -- Power of Cryptography

    Power of Cryptography Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 26622   Accepted: ...

  4. poj 2109 Power of Cryptography

    点击打开链接 Power of Cryptography Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 16388   Ac ...

  5. POJ 2109 Power of Cryptography【高精度+二分 Or double水过~~】

    题目链接: http://poj.org/problem?id=2109 参考: http://blog.csdn.net/code_pang/article/details/8263971 题意: ...

  6. POJ - 2109 Power of Cryptography(高精度log+二分)

    Current work in cryptography involves (among other things) large prime numbers and computing powers ...

  7. POJ 2109 Power of Cryptography 大数,二分,泰勒定理 难度:2

    import java.math.BigInteger; import java.util.Scanner; public class Main { static BigInteger p,l,r,d ...

  8. 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 ...

  9. SOJ 1017 Power of Cryptography 库函数精度

    Background Current work in cryptography involves (among other things) large prime numbers and comput ...

随机推荐

  1. Hibernate 老外的完整教程

    http://viralpatel.net/blogs/hibernate-many-to-many-annotation-mapping-tutorial/

  2. PHP生成表格

    <?php /* DROP TABLE IF EXISTS `art`; CREATE TABLE `art` ( `id` int(11) NOT NULL AUTO_INCREMENT, ` ...

  3. [Database][SQL] 取得SQLServer中某一欄位名稱所在的資料表及欄位相關資訊

    取得SQLServer中某一欄位名稱所在的資料表及欄位相關資訊  

  4. git操作技巧(转载)

    转载自:https://segmentfault.com/q/1010000000181403 git支持很多种工作流程,我们采用的一般是这样,远程创建一个主分支,本地每人创建功能分支,日常工作流程如 ...

  5. 微软职位内部推荐-SDE II-MODC-Beijing

    微软近期Open的职位: JOB TITLE: Software Design Engineer IIDEPARTMENT: Microsoft Office Division ChinaIMMEDI ...

  6. Contest2037 - CSU Monthly 2013 Oct (problem F :ZZY and his little friends)

    http://acm.csu.edu.cn/OnlineJudge/problem.php?cid=2037&pid=5 [题解]: 没想通这题暴力可以过.... [code]: #inclu ...

  7. 1024: [SCOI2009]生日快乐 - BZOJ

    Description windy的生日到了,为了庆祝生日,他的朋友们帮他买了一个边长分别为 X 和 Y 的矩形蛋糕.现在包括windy,一共有 N 个人来分这块大蛋糕,要求每个人必须获得相同面积的蛋 ...

  8. Codeforces Round #260 (Div. 1) C. Civilization 树的中心+并查集

    题目链接: 题目 C. Civilization time limit per test1 second memory limit per test256 megabytes inputstandar ...

  9. 初试docker以及搭建mysql on docker

    前一阵阅读了google的borg论文,在最后的related works和总结中发现了kubernetes.从论文中了解的kubernetes这个东西很有意思,按照论文所说,它的实现有希望解决an ...

  10. GIT:本地有更改,但强制作远程仓库里作更新

    有时,紧急线上修改时,这个功能有用处的. git fetch --all git reset --hard origin/master ================ git reset --har ...