Huatuo's Medicine

Time Limit: 3000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others)

Huatuo was a famous doctor. He use identical bottles to carry the medicine. There are different types of medicine. Huatuo put medicines into the bottles and chain these bottles together.

However, there was a critical problem. When Huatuo arrived the patient's home, he took the chain out of his bag, and he could not recognize which bottle contains which type of medicine,but he remembers the order of the bottles on the chain.

Huatuo has his own solution to resolve this problem. When he need to bring
2
types of medicines, E.g. A and B, he will put A into one bottle and put
B into two bottles.Then he will chain the bottles in the order of
-B-A-B-
. In this way, when he arrived the patient's home, he knew that the bottle in the middle is medicine
A and the bottle ontwo sides are medicine B.

Now you need to help Huatuo to work out what's the minimal number of bottles needed if he want to bring
N
types of medicine.

Input

The first line of the input gives the number of test cases,
T(1≤T≤100).
T
lines follow. Each line consist of one integer N(1≤N≤100),the
number of types of the medicine.

Output

For each test case, output one line containing Case #x: y, where
x
is the test case number (starting from 1)
and y
is the minimal number of bottles Huatuo needed.

Sample input and output

#include<stdio.h>
int main()
{
long long n,t,Case=1;
scanf("%lld",&t);
while(t--)
{
scanf("%lld",&n);
printf("Case #%lld: %lld\n",Case++,2*(n-1)+1);
}
return 0;
}

Sample Input Sample Output
1
2
Case #1: 3

Huatuo's Medicine的更多相关文章

  1. The 2015 China Collegiate Programming Contest L. Huatuo's Medicine hdu 5551

    Huatuo's Medicine Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others ...

  2. 2015南阳CCPC L - Huatuo's Medicine 水题

    L - Huatuo's Medicine Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description Huatuo was a famous ...

  3. 2015南阳CCPC L - Huatuo's Medicine 签到

    L - Huatuo's Medicine Description Huatuo was a famous doctor. He use identical bottles to carry the ...

  4. HDU-5551 Huatuo's Medicine

    Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission( ...

  5. HDOJ5551 Huatuo's Medicine

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5551 题目大意:... 题目思路:乱搞?模拟? #include <stdio.h> vo ...

  6. ACM学习历程—UESTC 1226 Huatuo's Medicine(数学)(2015CCPC L)

    题目链接:http://acm.uestc.edu.cn/#/problem/show/1226 题目就是构造一个对称的串,除了中间的那个只有1个,其余的两边都是对称的两个,自然答案就是2*n-1. ...

  7. CCPC L(水)

    Huatuo's Medicine Time Limit: 3000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others ...

  8. zoj 3812 We Need Medicine (dp 状压)

    先贴一下转载的思路和代码,,,:http://blog.csdn.net/qian99/article/details/39138329 状压dp博大精深啊,以后看到n<=50都可以往状压上想, ...

  9. Wiki with Herbal Medicine

    Problem H. Wiki with Herbal MedicineInput file: standard input Time limit: 1 secondOutput file: stan ...

随机推荐

  1. SNMP简单概述

    一.SNMP简单概述 1.1.什么是Snmp SNMP是英文"Simple Network Management Protocol"的缩写,中文意思是"简单网络管理协议& ...

  2. Kafka .NET操作

    Kafaka .NET连接 Kafka目前主流在用的.NET客户端有两个:一个是kafka-net,另外一个是Confluent.Kafka,这里给出使用示例: kafka-net示例: public ...

  3. LeetCode Weekly Contest 20

    1. 520. Detect Capital 题目描述的很清楚,直接写,注意:字符串长度为1的时候,大写和小写都是满足要求的,剩下的情况单独判断.还有:我感觉自己写的代码很丑,判断条件比较多,需要改进 ...

  4. CSS浮动相关解决办法

    浮动元素引起的问题: 1. 父元素的一级子元素全都为浮动元素的情况下,父元素的高度无法被撑开,影响与父元素同级的元素 2. 与浮动元素同级的非浮动元素(内容)会跟随其后 3. 若非第一个元素浮动,则该 ...

  5. (转)redux

    随着 JavaScript 单页应用开发日趋复杂,越来越多的 state (状态)需要在前端进行管理. 这些 state 可能包括服务器响应.缓存数据.本地生成尚未持久化到服务器的数据,也包括 UI ...

  6. Selenium3+python自动化008-常用操作

    一.元素常用操作 1. clear()            清除文本 2. send_keys()        模拟输入 3. click()            单击元素 4.get_attr ...

  7. Jquery中拿到相同的对应的所有的标签

    在Jquery中相同的ID号不能用$()获得,即使是$().each()也不能获得所有的ID相同的元素,只能获得第一个匹配的元素. 比如: 以上4个div,如果用$("#jevoly&quo ...

  8. gitlab安装和汉化

    Centos 7.x 安装 gitlab-ce-8.8.0-ce 一.安装配置依赖项 yum -y install curl unzip policycoreutils git wget # 依赖包 ...

  9. 【leecode】宝石与石头

    给定字符串J 代表石头中宝石的类型,和字符串 S代表你拥有的石头. S 中每个字符代表了一种你拥有的石头的类型,你想知道你拥有的石头中有多少是宝石. J 中的字母不重复,J 和 S中的所有字符都是字母 ...

  10. VS2013 opencv 无法删除“继承的值”问题解决方案

    http://www.360doc.com/content/15/0103/14/110467_437739376.shtml 解决方案: (1)视图——其他窗口——属性管理器. 注意:是”属性管理器 ...