SDUTOJ 3036 你打我啊
来源:互联网 发布:哪些高校有网络教育 编辑:程序博客网 时间:2024/05/01 16:25
你打我啊
Time Limit: 500ms Memory limit: 65536K 有疑问?点这里^_^
题目描述
最近看了一个非常好玩的题,如果有972杯水,其中有971个没有毒的,1个有毒的,其中有毒的水的毒性需要一周才会发作,那么,我们最少需要多少只小白鼠才能够在一周的时间内确定那一杯水是有毒的。当然这种水题肯定难不住各位队员们。所以我要出的题和上述的东西没有一点关系。
那既然上面的东西和这次的题没有什么关系那我为什么要说呢,很明显,我在凑字数,我实在是不知道该怎么凑了呀,他们说让我来一个又臭又长一看就不想做的题,还让我用英文写,所以嘛,我英语不好只能先来个中文废话了,Ok上正题吧。
Christmas was coming .Mr Smith had no money to buy any presents for his children .His wife was ill and he spent a lot of money on her medicine .
And the harvest was bad and all his family were going go be hungry the next spring .He was quite worried about it .
“We had only a cock ,”said Mrs Smith one day .“You’d better take it to the town .Sell it there and buy some cakes and sweets for our children .”
“It’s a good idea !”the man said and caught the cock the next morning and put it into a box .It was difficult to walk on the road covered with thick snow .
Two hours later he was very tied and wanted to have a rest .He put the box to the ground and sat down .
“The air in the box must be close ,”the man said to himself .“I’d better let the cock walk outside for a while ,or it’ll die .”
So he put the cock to the ground .When he started again ,he couldn’t catch it any longer .
“How foolish you are !”Mr Smith called out angrily .“You can herald the break of day at night but you cann’t find the way to the town in the daytime !”
Ok,It is a nonsense.Our question is what I mentioned in the first paragraph,if we have N cups of water.How many mice we need.
输入
多组输入,每组输入一个N(1<=N<=2^32-1);
输出
输出小白鼠的数目
示例输入
1000972
示例输出
1010
提示
来源
Flyfire doubi
示例程序
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
using namespace std;
int main()
{
long long int n;
while(scanf("%lld",&n)!=EOF)
{
int k = 1;
while(n != 1)
{
n = n/2;
k++;
}
printf("%d\n",k);
}
return 0;
}
#include<algorithm>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
using namespace std;
int main()
{
long long int n;
while(scanf("%lld",&n)!=EOF)
{
int k = 1;
while(n != 1)
{
n = n/2;
k++;
}
printf("%d\n",k);
}
return 0;
}
0 0
- SDUTOJ 3036 你打我啊
- SDUTOJ 3035 你猜我猜不猜你猜不猜
- SDUToj 3035 你猜我猜不猜你猜不猜
- 啊我打完
- 看了不笑你打我
- “函数”过来过来,我不打你!
- 我打我打我打
- sdutoj
- SDUTOJ
- SDUToj
- SDUToj
- SDUToj
- 19 个 Android 开发工具--不好你打我
- CentOS 6.4 拨号上网全攻略,不行你打我~
- 不会你打我系列--轻松解决数据库无法连接
- android获取键盘高度,不能用你打我
- SDUTOJ-3788-Stone祝你元宵节快
- 对外哈达威打我啊我我啊啊啊
- sencha touch学习笔记二:编写第一个例子
- spring jar包 官网下载方法
- 【 D3.js 进阶系列 — 3.1 】 圆形分区图
- Android界面开发的相关知识
- Atitit. 构造ast 语法树的总结attilax oao
- SDUTOJ 3036 你打我啊
- 迭代一感想&总结 - 赵雷彧
- 2.3运算符和表达式(上)
- MySql事务隔离级别锁机制实际案例深入分析
- 【DP】 LightOJ 1011 - Marriage Ceremonies状压
- ZOJ 3830 Alkanes 大模拟!!
- SDUTOJ 3037 让领导先走
- 学习方法之"学问""学猜""学查"
- JDK之BufferedInputStream分析