UVA10916Factstone Benchmark
来源:互联网 发布:centos系统还原 编辑:程序博客网 时间:2024/06/09 13:48
UVA-10916
题意:计算机的计算处理器的位数每10年会翻一番,给一个年份,求这年n为多少时n!>= 计算机的处理范围。
解题思路:知道年份可以知道到底翻了a=(year-1960)/10 番,能求出处理位数 t = 2^(a+2),能处理的值的范围为2^t,大概就是求(N-1)! <= 2^t <= N! 。两关于2取对数,Sigma log2(i) (i= 1 to n) < t,枚举n就好了。
/************************************************************************* > File Name: UVA-10916.cpp > Author: Narsh > > Created Time: 2016年07月15日 星期五 10时12分28秒 ************************************************************************/#include <iostream>#include <algorithm>#include <cstdio>#include <cstring>#include <cmath>using namespace std;int t,n;int main () { while (scanf("%d",&t) && t) { t=(t-1960)/10; t=pow(2,t+2); n=0; double s=0; while (s/log(2) < t ) { n++; s+=log(n); } n--; printf("%d\n",n); }}
0 0
- UVA10916Factstone Benchmark
- benchmark
- Benchmark
- benchmark
- Benchmark
- GC1030 benchmark
- my benchmark
- Factstone Benchmark
- Factstone Benchmark
- Factstone Benchmark
- Factstone Benchmark
- Factstone Benchmark
- hdfs benchmark
- apache benchmark
- Factstone Benchmark
- Apache benchmark
- JaConTeBe benchmark
- SpecMPI2007 benchmark
- jzoj 1568. 【普及模拟】石子游戏 解题报告
- 运算符和表达式
- 随机森林算法的源码分析(一)
- Android studio libpng error: Not a PNG file
- 指针数组 数组指针 指针函数 函数指针
- UVA10916Factstone Benchmark
- 探讨多个boot合并为一个boot的问题
- 链表去重(强行用map水过)
- firefox等浏览器清除a标签点击后的虚线问题
- poj3254 Corn Fields (状压dp)
- 结构化随机森林源码分析
- 莫比乌斯反演入门 HDOJ 1695:GCD 、BZOJ 2301: [HAOI2011]Problem b
- 12.Which is the correct description of a pinned buffer in the database buffer cache?
- [javascript权威指南][阅读笔记]五