博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
UVA - 11986 Save from Radiation
阅读量:6787 次
发布时间:2019-06-26

本文共 3774 字,大约阅读时间需要 12 分钟。

Description

J

Save from Radiation

Most of you are aware of Nuclear Power Plant Explosion at Fukushima after devastating earth quake and tsunami. Many people in Bangladesh were seen to be concerned with radiation. The message says:

BBC Flash news: Japan Government confirms radiation leak at Fukushima nuclear plants. Asian countries should take necessary precautions. If rain comes, remain indoors first 24 hours. Close doors and windows. Swab neck skin with betadine where thyroid area is, radiation hits thyroid first. Take extra precautions. Radiation may hit Philippine at around 4 pm today. If it rains today or in the next few days in Hong Kong, do not go under the rain. If you get caught out, use an umbrella or raincoat, even if it is only a drizzle. Radioactive particles, which may cause burns, alopecia or even cancer, may be in the rain.

Many people suggested many things. We, the programmer society, were not inactive. We uploaded a picture in a very popular social network website, facenote and said, "There are two ways to be safe from radiation. One is the Disky way and another is the Buseen way." You may get clear idea of those two ways from the picture.

Anyway, after the explosion of Fukushima Nuclear Power Plant a bottle of water was sent to my laboratory for experiment. But my stupid robot assistant kept it with N identical water bottles of which I can't distinguish the special water bottle which came from Japan. I know that if a rat drinks the water from the special bottle, it will die in the 5th minute. Now, I want to identify the special bottle. But I do not like rat either. So, I want to buy minimum number of rats. Can you help me to find out the minimum number of rats I need for identifying the special bottle in 5 minutes?

I forgot to tell you that, only one drop of water from a bottle is enough to find out if the water is safe or not. And you may also give waters from several bottles to a single rat. If one of these bottles is the special bottle then the rat will die, otherwise it will not. And assume that the time to give waters to the rats is negligible, because once you decide the strategy; you may ask the robot assistant to do it. And the robot can do it in no time. And you can also assume that the bottles contain sufficient amount of waters.

Input

Input starts with an integer T (≤ 3000), denoting the number of test cases.

Each test case starts with a line containing an integer N(0 ≤ N ≤ 1016).

Output

For each case, print the case number and the minimum number of rats required for identifying the special bottle.

Sample Input

Output for Sample Input

1
1
2

Case 1: 1

Case 2: 2

Notes

1.      For case 2, the robot assistant kept the special bottle with 2 identical bottles. So, there are 3 bottles, one of them is the special bottle. The minimum number of rats is 2. Because just give a drop from bottle 1 to the 1st rat and a drop from bottle 2 to the 2nd rat. If the 1st rat dies, so it's clear that bottle 1 is the special one. If the 2nd rat dies, then the second bottle is the special one. And if none of them dies, then the 3rd bottle is the special bottle. So, 2 rats are enough. But there are other options, too. Like give the first rat two drops from bottle 1 and 2. And give the second rat a drop from bottle 2. Then the special bottle can also be determined. So, there can be many options, but you need at least 2 rats.

题意:事实上就是求n个普通液体和一瓶毒液,求最少须要几仅仅老鼠同一时候实验,找出毒液

思路:事实上就是能有几个2组成,不够的也要算

#include 
#include
#include
#include
using namespace std;int main() { int t; int cas = 1; long long n, ans; scanf("%d", &t); while (t--) { scanf("%lld", &n); ans = 0; while (n) { ans++; n /= 2; } printf("Case %d: ", cas++); printf("%lld\n", ans); } return 0;}

转载地址:http://kzsgo.baihongyu.com/

你可能感兴趣的文章
windows下彻底删除oracle步骤
查看>>
LAMP平台下搭建论坛和博客系统
查看>>
关于学习的一些困惑
查看>>
RedHat系统怎么设置或更改屏幕分辨率
查看>>
spring mybatis整合配置文件
查看>>
02(maven+SSH)网上商城项目实战之数据库设计(PMD)
查看>>
谈Docker安全合规建设
查看>>
LR中的关联
查看>>
nginx配置php连接
查看>>
调整状态学会放下与五月份的个人计划
查看>>
Oracle中如何将姓名中有空格的字段更新成没有空格的?
查看>>
xp扩容C盘后盘符丢失的资料怎么找到
查看>>
CVE-2017-12617
查看>>
SSH管理服务
查看>>
废旧行业迎来春天 环保部重启绿色GDP研究
查看>>
监控——JVM监控安装
查看>>
Working with System Properties
查看>>
为什么我墙裂建议大家使用枚举来实现单例
查看>>
记一次阿里云服务器安装Python的血泪史
查看>>
c++函数模块与其相关内容
查看>>