Huatuo's Medicine

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)
Total Submission(s): 398    Accepted Submission(s): 272

Problem Description
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 on two 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
1
2
 
Sample Output
Case #1: 3
 
 #include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
int main() {
int T, tot = ;
scanf("%d", &T);
while (T--) {
int n;
scanf("%d", &n);
printf("Case #%d: %d\n", ++tot, *n-);
}
}

The 2015 China Collegiate Programming Contest L. Huatuo's Medicine hdu 5551的更多相关文章

  1. The 2015 China Collegiate Programming Contest D.Pick The Sticks hdu 5543

    Pick The Sticks Time Limit: 15000/10000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others ...

  2. The 2015 China Collegiate Programming Contest E. Ba Gua Zhen hdu 5544

    Ba Gua Zhen Time Limit: 6000/4000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total ...

  3. The 2015 China Collegiate Programming Contest A. Secrete Master Plan hdu5540

    Secrete Master Plan Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Othe ...

  4. The 2015 China Collegiate Programming Contest Game Rooms

    Game Rooms Time Limit: 4000/4000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others) Submi ...

  5. The 2015 China Collegiate Programming Contest K Game Rooms hdu 5550

    Game Rooms Time Limit: 4000/4000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total ...

  6. The 2015 China Collegiate Programming Contest C. The Battle of Chibi hdu 5542

    The Battle of Chibi Time Limit: 6000/4000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Othe ...

  7. The 2015 China Collegiate Programming Contest H. Sudoku hdu 5547

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

  8. The 2015 China Collegiate Programming Contest G. Ancient Go hdu 5546

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

  9. The 2015 China Collegiate Programming Contest -ccpc-c题-The Battle of Chibi(hdu5542)(树状数组,离散化)

    当时比赛时超时了,那时没学过树状数组,也不知道啥叫离散化(貌似好像现在也不懂).百度百科--离散化,把无限空间中无限的个体映射到有限的空间中去,以此提高算法的时空效率. 这道题是dp题,离散化和树状数 ...

随机推荐

  1. XMPP框架下微信项目总结(6)刷新好友列表(删除,添加好友)

    原理:1 服务器(openfire)添加/删除 好友,会向客户端(app)发送消息, 2 代理(xmppStreamDelegate)监听到添加/删除消息后,花名册模块(RosterModule)会在 ...

  2. iOS系类教程之用instruments来检验你的app

    比较了好多关于instruments 还是发现老外写的比较牛逼.于是果断翻译过来.有能力的的可以去看英文原版,鼓励大家看原版资料远离二手教程.这里是原文   入门 为了节省大家的时间,提供一个演示的D ...

  3. 20145206《Java程序设计》第9周学习总结

    20145206 <Java程序设计>第9周学习总结 教材学习内容总结 第十六章 整合数据库 JDBC是用于执行SQL的解决方案,开发人员使用JDBC的标准接口,数据库厂商则对接口进行操作 ...

  4. PAL/NTSC 制电视广播技术有关知识--FPGA

    1.PAL和NTSC的区别 常见的电视信号制式是PAL和NTSC,另外还有SECAM等. NTSC即正交平衡调幅制,PAL为逐行倒像正交平衡调幅制. (1)PAL电视标准  PAL电视标准,每秒25帧 ...

  5. python以指定宽度及格式输出字符串

  6. Android -- getQuantityString无效

    原文:http://www.xuebuyuan.com/1510993.html 原因:中文没有复数语法.

  7. .net学习之CTS、CLS和CLR

    CLR:公共语言运行时,就是所有.net语言写的程序的公共运行时环境,比如C#.VB.Net等语言写的程序需要运行在CLR上,然后CLR解析执行操作系统的相关指令,CLR是.net程序运行在操作系统的 ...

  8. eclipse项目迁移到android studio(图文最新版)

    前言 最近Android studio(下文简称AS)官方发布了正式版,目前火得不行.个人认为主要是因为android是google自家的产品,AS也是他自己搞的IDE,以后的趋势android开发肯 ...

  9. MYSQL的增删改查语句样码

    慢慢来,慢慢来.. 增: INSERT INTO person (person_id, fname, lname, gender, birth_date) VALUES (null, 'William ...

  10. poj 2236:Wireless Network(并查集,提高题)

    Wireless Network Time Limit: 10000MS   Memory Limit: 65536K Total Submissions: 16065   Accepted: 677 ...