HDU 1141 Factstone Benchmark (数学 )
Problem Description
Amtel has announced that it will release a 128-bit computer chip by 2010, a 256-bit computer by 2020, and so on, continuing its strategy of doubling the word-size every ten years. (Amtel released a 64-bit computer in 2000, a 32-bit computer in 1990, a 16-bit computer in 1980, an 8-bit computer in 1970, and a 4-bit computer, its first, in 1960.)
Amtel will use a new benchmark - the Factstone - to advertise the vastly improved capacity of its new chips. The Factstone rating is defined to be the largest integer n such that n! can be represented as an unsigned integer in a computer word.
Given a year 1960 ≤ y ≤ 2160, what will be the Factstone rating of Amtel's most recently released chip?
There are several test cases. For each test case, there is one line of input containing y. A line containing 0 follows the last test case. For each test case, output a line giving the Factstone rating.
Sample Input
1960
1981
0
Sample Output
3
8
分析:
这题目意思很难理解,看了别人的解释后懂了,但是不理解为什么这么做,先留着
Amtel公司宣布他们会在2010年发行128位元的计算机,
在2020年发行256位元的计算机,
在这个策略之下往后每10年就发行2倍位元的计算机。
(Amtel公司在2000年发行 64位元,1990年发行32位元计算机,
1980年发行16位元计算机,1970年发行8位元计算机,
1960年发行4位元计算机,也是第一部计算机)。
Amtel公司将使用一种新的规格基准 「Factstone」来广告并凸显新一代计算机芯片容量的神速进步。
「Factstone」的等级被定义为:
以一个最大的整数 n 表示,使得 n! 可以在一个计算机字组(word,也就是我们说的多少位元)中
被以 unsigned integer(无号整数)来表示。
例如:在1960年时的计算机为4位元,也就是一个字组能表达 0~15的整数。
而 3! 是在这个范围中最大的阶层数了(4! > 15),所以其「Factstone」等级是 3。
给你一个公元年数 y ,请问最新发行的Amtel计算机其「Factstone」等级是多少?
代码:
#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<cmath>
#include<string.h>
using namespace std;
int main()
{
int n;
while(~scanf("%d",&n),n)
{
int num=(n/10)-194;
int time=1;
for(int i=1; i<=num; i++)
time*=2;///每10年就增长2倍
double Max=time*log10(2);
// cout<<Max<<endl;
double cnt=0,i=1;
while(cnt<Max)
{
cnt+=log10(i);
i++;
}
cout<<i-2<<endl;
}
return 0;
}
HDU 1141 Factstone Benchmark (数学 )的更多相关文章
- Factstone Benchmark(数学)
http://poj.org/problem?id=2661 题意:Amtel在1960年发行了4位计算机,并实行每十年位数翻一番的策略,将最大整数n作为改变的等级,其中n!表示计算机的无符号整数(n ...
- uva 10916 Factstone Benchmark(对数函数的活用)
Factstone Benchmark Amtel has announced that it will release a 128-bit computer chip by 2010, a 256- ...
- Factstone Benchmark
[问题描述] Amtel已经宣布,到2010年,它将发行128位计算机芯片:到2020年,它将发行256位计算机:等等,Amtel坚持每持续十年将其字大小翻一番的战略.(Amtel于2000年发行了6 ...
- HDU 4816 Bathysphere(数学)(2013 Asia Regional Changchun)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4816 Problem Description The Bathysphere is a spheric ...
- HDU 5584 LCM Walk 数学
LCM Walk Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5584 ...
- HDU 4336 Card Collector 数学期望(容斥原理)
题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=4336 题意简单,直接用容斥原理即可 AC代码: #include <iostream> ...
- HDU 5570 balls 期望 数学
balls Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5570 De ...
- hdu 4710 Balls Rearrangement (数学思维)
意甲冠军:那是, 从数0-n小球进入相应的i%a箱号.然后买一个新的盒子. 今天的总合伙人b一个盒子,Bob试图把球i%b箱号. 求复位的最小成本. 每次移动的花费为y - x ,即移动前后盒子编号 ...
- HDU 4790 Just Random 数学
链接:pid=4790">http://acm.hdu.edu.cn/showproblem.php?pid=4790 意:从[a.b]中随机找出一个数字x,从[c.d]中随机找出一个 ...
随机推荐
- 安装Sql Server 2008的时候报错说找不到某个安装文件
在安装Sql Server 2008的时候,报错说找不到某个安装文件,但是这个文件明明在那,百思不得其解. 最后看到一个老外的文章里面说,你要确认,你能访问到这个文件 ...
- ExtJs工具篇(3)——Aptana Studio3乱码的问题
在Aptana Studio里面使用,发现输入的中文是乱码,在浏览器中浏览也是乱码,想着肯定是编码的问题,但是一直没有找到在那个地方设置.以为汉化后就可以了,没想到汉化后竟然还是乱码, ...
- 【转】ASP.NET Core 快速入门(环境篇)
原文链接:http://www.cnblogs.com/zhaopei/p/netcore.html [申明]:本人.NET Core小白.Linux小白.MySql小白.nginx小白.而今天要说是 ...
- node gyp的问题
解决 binding.gyp not found (xxx/xxx/xxx) while trying to load binding.gyp 问题 在使用ccap图形验证码模块时遇到这个问题 Err ...
- LCA(最近公共祖先)——离线 Tarjan 算法
tarjan算法的步骤是(当dfs到节点u时):1 在并查集中建立仅有u的集合,设置该集合的祖先为u1 对u的每个孩子v: 1.1 tarjan之 1.2 合并v到父节点u的集合,确保集合的祖 ...
- 团队项目-第十次scrum 会议
时间:11.6 时长:20分钟 地点:主235教室走廊 工作情况 团队成员 已完成任务 待完成任务 解小锐 完成多种招聘方式的逻辑编写 陈鑫 实现游戏的存档功能 李金奇 添加多种招聘方式等功能 王辰昱 ...
- Camera2与TextureView使用
package com.intsig.bcrsdk.demo.Activity; import android.annotation.TargetApi; import android.app.Act ...
- neutron DVR
DVR 简介 DVR 提出的背景 在 Neutron 的网络环境中,跨子网的虚机通信是需要通过 Neutron 的路由器.这既包括不同子网的虚拟机之间的通信,又包括虚拟机与外网之间的通信.在 DVR ...
- log4j的常用使用方法
第一步,引入jar包,不做介绍. 第二步,创建以下类(固定写法) package smn.util; import org.apache.log4j.Logger; public class MyLo ...
- 【bzoj1458】士兵占领 有上下界最小流
题目描述 有一个M * N的棋盘,有的格子是障碍.现在你要选择一些格子来放置一些士兵,一个格子里最多可以放置一个士兵,障碍格里不能放置士兵.我们称这些士兵占领了整个棋盘当满足第i行至少放置了Li个士兵 ...