poj 2661(关于对数log的应用)
2012-12-09 09:39
363 查看
题目链接:http://poj.org/problem?id=2661
利用:
2^n<1*2*3...m
n<log21+log22+log23.....然后换底公式
代码:
利用:
2^n<1*2*3...m
n<log21+log22+log23.....然后换底公式
代码:
#include <iostream> #include <cstdlib> #include <cstring> #include <cstdio> #include <cmath> #include <algorithm> #include <string> using namespace std; int find(int n){ double t=pow((double)2,(n-1960)/10+2),sum=0; int i=0; for(i=2;sum<t;i++){ sum+=log((double)i)/log((double)2); } return i-2; } int main(){ int n=0; while(scanf("%d",&n)&&n){ printf("%d\n",find(n)); } }
相关文章推荐
- POJ 2661-Factstone Benchmark(log()的应用)
- POJ-3308 最小点权覆盖-最小割的应用+取对数将乘法转加法
- poj 2661 Factstone Benchmark 取对数
- poj-1423 NYOJ_69 数字长度 斯特林公式 对数应用
- Log-Polar——关于对数极坐标
- poj 1019 Number Sequence 对数的分解应用
- ios开发关于log的一些应用http://blog.csdn.net/remote_roamer/article/details/7107320
- POJ 2661 Factstone Benchmark 斯特林(stirling公式)应用
- 关于部分应用无法向POJ提交代码的解决方案
- POJ 2661 Factstone Benchmark 斯特林(stirling公式)应用
- 关于log对数运算的笔记
- 关于Android应用的Log检查
- 关于Android中listView的复用及优化问题详解,应用开发者应多多使用,是app更顺畅,让用户更好体验!
- 配置DATAGUARD 时关于 LOG_FILE_NAME_CONVERT配置错误的解决
- 鸽巢原理应用-分糖果 POJ 3370 Halloween treats
- django关于URL、Template、Model的一些高级应用
- Barry手记:关于用PB设计应用框架的思想(1)
- 关于更改jdk源码替换应用的例子
- 读《轻量级Java_EE企业应用实战》与关于JavaBean
- poj 2406字符串最小环节的应用