poj 2661 Factstone Benchmark
/**
大意: 求m!用2进制表示有多少位 m! = 2^n 两边同时取对数 log2(m!) = n
即 log2(1) + log2(2)+log2(3)+log2(4)...+log2(m) = n
枚举即可 拓展:
可以用斯特林(Stirling)公式求解 斯特林(Stirling)公式: log(x) =====ln(x) **/
#include <iostream>
#include <cmath>
using namespace std; int main()
{
int y;
while(cin>>y&&y){
int t = <<((y-)/+);
double m=;
double res =log(m)/log(2.0);
while(res<=t){
m++;
res += log(m)/log(2.0) ;
}
cout<<m-<<endl;
}
return ;
}
poj 2661 Factstone Benchmark的更多相关文章
- poj 2661 Factstone Benchmark (Stirling数)
//题意是对于给定的x,求满足n! <= 2^(2^x)的最大的n//两边同取以二为底的对数,可得: lg2(n!) <= 2^x 1. log2(n!) = log2(1) + lo ...
- uva 10916 Factstone Benchmark(对数函数的活用)
Factstone Benchmark Amtel has announced that it will release a 128-bit computer chip by 2010, a 256- ...
- HDU 1141 Factstone Benchmark (数学 )
题目链接 Problem Description Amtel has announced that it will release a 128-bit computer chip by 2010, a ...
- Factstone Benchmark(数学)
http://poj.org/problem?id=2661 题意:Amtel在1960年发行了4位计算机,并实行每十年位数翻一番的策略,将最大整数n作为改变的等级,其中n!表示计算机的无符号整数(n ...
- Factstone Benchmark
[问题描述] Amtel已经宣布,到2010年,它将发行128位计算机芯片:到2020年,它将发行256位计算机:等等,Amtel坚持每持续十年将其字大小翻一番的战略.(Amtel于2000年发行了6 ...
- sicily 1119 Factstone Benchmark
题意:求满足n! < 2^k,n的最大值! 解题:指数比较转换成对数比较,达到降幂! 其中: log (n!) = log(n)+log(n-1)+...+log(1); log(2^k) = ...
- POJ 2661
#include<iostream> #include<stdio.h> using namespace std; int main() { //freopen("a ...
- poj2661 Factstone Benchmark(大数不等式同取对数)
这道题列出不等式后明显是会溢出的大数,但是没有必要写高精度,直接两边取对数(这是很简明实用的处理技巧)得: log2(n!)=log2(n)+log2(n-1)+...+log2(1)<=log ...
- 【poj2661】Factstone Benchmark(斯特林公式)
传送门 题意: 给出\(x,x\leq 12\),求最大的\(n\),满足\(n!\leq 2^{2^x}\). 思路: 通过斯特林公式: \[ n!\approx \sqrt{2\pi n}\cdo ...
随机推荐
- MVC模式和URL访问
一.什么是MVC //了解 M -Model 编写model类 对数据进行操作 使用Model类 来操作数据 V -View 编写html文件,页面呈现 C -Controller 编写类文件(Use ...
- 基于thinkphp的uploadify上传图功能
php Action server端 <?php /* * To change this template, choose Tools | Templates * and open the ...
- Nice way for strip_tags a like
I found this code works great as the function strip_tags in php to replace html tags from string and ...
- 安卓中onBackPressed ()方法的使用
一.onBackPressed()方法的解释 这个方法放在 void android.app.Activity.onBackPressed() 在安卓API中它是这样解释的: public void ...
- video标签 拖动 转自w3school
调整视频大小 播放 暂停 用js实现 详细参见http://www.w3school.com.cn/tiy/t.asp?f=html5_video_dom 图片的拖动详见http://www.w3sc ...
- iOS 10中如何搭建一个语音转文字框架
在2016WWDC大会上,Apple公司介绍了一个很好的语音识别的API,那就是Speech framework.事实上,这个Speech Kit就是Siri用来做语音识别的框架.如今已经有一些可用的 ...
- (转)Log4J日志配置详解
http://www.cnblogs.com/ITtangtang/p/3926665.html 一.Log4j简介 Log4j有三个主要的组件:Loggers(记录器),Appenders (输出源 ...
- [Swust OJ 582]--放学了,抢机子了(SPFA)
题目链接:http://acm.swust.edu.cn/problem/0582/ Time limit(ms): 5000 Memory limit(kb): 65535 Descriptio ...
- MySql 数据库定时备份
1.使用sqldump+任务计划 mysqldump备份成sql文件==============假想环境:MySQL 安装位置:C:\MySQL论坛数据库名称为:bbsMySQL root 密 ...
- poj 1410 计算几何
/** 注意: 千万得小心..就因为一个分号,调了一个晚上... **/ #include <iostream> #include <algorithm> using name ...