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 <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
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;
}

UVA - 11986 Save from Radiation的更多相关文章

  1. uva 11986

    假设有n只老鼠 每只老鼠有两种状态 死或活 则n只老鼠有 2^n方种状态 所以n只老鼠可以确定2^n只瓶子 #include <cstdio> #include <cstdlib&g ...

  2. uva 10894 - Save Hridoy

    #include <iostream> #include <string> #include <cstring> #include <cmath> us ...

  3. UVa 12403 - Save Setu

    题目:有两种操作:1.当前数值添加.2.输出当前数值. 分析:简单题.模拟就可以. 说明:A+B. #include <iostream> #include <cstdlib> ...

  4. UVA 1291 十四 Dance Dance Revolution

    Dance Dance Revolution Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Su ...

  5. UVA 322 ships (POJ 1138)

    题目地址: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem ...

  6. UVA它11292 - Dragon of Loowater

    Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance tur ...

  7. UVA 257 - Palinwords(弦HASH)

    UVA 257 - Palinwords 题目链接 题意:输出一个文本里面的palinword,palinword的定义为.包括两个不同的回文子串,而且要求回文子串不能互相包括 思路:对于每一个单词推 ...

  8. UVA 11292 Dragon of Loowater(简单贪心)

    Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance tur ...

  9. UVA 1341 - Different Digits(数论)

    UVA 1341 - Different Digits 题目链接 题意:给定一个正整数n.求一个kn使得kn上用的数字最少.假设同样,则输出值最小的 思路: 首先利用鸽笼原理证明最多须要2个数字去组成 ...

随机推荐

  1. 翻译器DIY————次序

    突然有一种冲动,想要写一个编译器. 因此,检查在网上搜索相关信息,思想direct3D 有本书叫龙,也有个龙书 Compilers Principles,Techniques, & Tool ...

  2. 采用curl库

    Windows通过使用curl库: 到http://curl.haxx.se/下了个curl的源代码下来,源代码是用VC6编译的,我在VS2005下又一次进行编译.竟然仅仅有一个警告. cUrl的实现 ...

  3. Linux进程管理(-)

    一.进程的类型 能够将执行在Linux系统中的进程分为三种不同的类型: 交互进程:由一个Shell启动的进程.交互进程既能够在前台执行,也能够在后台   执行. 批处理进程:不与特定的终端相关联,提交 ...

  4. 基于Hadoop2.2.0版本号分布式云盘的设计与实现

    基于Hadoop2.2.0版本号分布式云盘的设计与实现 一.前言 在学习了hadoop2.2一个月以来,我重点是在学习hadoop2.2的HDFS.即是hadoop的分布式系统,看了非常久的源代码看的 ...

  5. Java得到年在一个季度的错误的第一天

    1.错误叙述性说明 Exception in thread "main" java.lang.IllegalArgumentException: Cannot format giv ...

  6. 用于主题检测的临时日志(18506589-369d-4505-a204-3678db17eae5 - 3bfe001a-32de-4114-a6b4-4005b770f6d7)

    这是一个未删除的临时日志.请手动删除它.(252f1b1e-5ce3-42a8-95da-bc0acbd4f637 - 3bfe001a-32de-4114-a6b4-4005b770f6d7)

  7. High Performance Browser Networking - TCP UDP TLS

    延迟 定义和标准延迟 延迟简单地说,它是一种转移或信息包从起点到终点,所花费的时间. 延迟=发送延迟+传播延迟+处理延迟+排队延迟: Propagation delay 传播时延 传播时延这个概念.是 ...

  8. SSH深度历险(三) EJB Session Bean有状态和无状态的差别与联系

    刚開始对两种sessionbean存在误解.觉得有状态是实例一直存在,保存每次调用后的状态,并对下一次调用起作用.而觉得无状态是每次调用实例化一次,不保留用户信息.细致分析并用实践检验后,会发现,事实 ...

  9. Pro Aspnet MVC 4读书笔记(3) - Essential Language Features

    Listing 4-1. The Initial Content of the Home Controller using System; using System.Collections.Gener ...

  10. 大约SQL/NoSQL数据库搜索/思考查询

    转载请注明出处:jiq•钦's technical Blog Hbase特征: 近期在学习Hbase.Hbase基于行健是建立了索引的,查询速度会很快,全然实时. 可是Hbase要基于行健之外的字段进 ...