Huatuo's Medicine
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 . In this way, when he arrived the patient's home, he knew that the bottle in the middle is medicine
-B-A-B-
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 |
Case #1: 3 |
Huatuo's Medicine的更多相关文章
- 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 ...
- 2015南阳CCPC L - Huatuo's Medicine 水题
L - Huatuo's Medicine Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description Huatuo was a famous ...
- 2015南阳CCPC L - Huatuo's Medicine 签到
L - Huatuo's Medicine Description Huatuo was a famous doctor. He use identical bottles to carry the ...
- HDU-5551 Huatuo's Medicine
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission( ...
- HDOJ5551 Huatuo's Medicine
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5551 题目大意:... 题目思路:乱搞?模拟? #include <stdio.h> vo ...
- ACM学习历程—UESTC 1226 Huatuo's Medicine(数学)(2015CCPC L)
题目链接:http://acm.uestc.edu.cn/#/problem/show/1226 题目就是构造一个对称的串,除了中间的那个只有1个,其余的两边都是对称的两个,自然答案就是2*n-1. ...
- CCPC L(水)
Huatuo's Medicine Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others ...
- zoj 3812 We Need Medicine (dp 状压)
先贴一下转载的思路和代码,,,:http://blog.csdn.net/qian99/article/details/39138329 状压dp博大精深啊,以后看到n<=50都可以往状压上想, ...
- Wiki with Herbal Medicine
Problem H. Wiki with Herbal MedicineInput file: standard input Time limit: 1 secondOutput file: stan ...
随机推荐
- Excel数据迁移到SQL Server遇到的若干问题
系统环境为:Windows Server 2008 r2 SQL Server 2012 1.建表过程中,如果用图形化的方式修改表结构会遇到问题: '不允许保存更改.您所做的更改要求删除并重新创建以下 ...
- Linux下实现视频读取
V4L(video4linux是一些视频系统,视频软件.音频软件的基础,经常时候在需要采集图像的场合,如视频监控,webcam,可视电话,经常使用在embedded linux中是linux嵌入式开发 ...
- 【JavaScript从入门到放弃】JS基础-01
作为一个前端开发人员,JS是我们行走江湖吃饭的家伙.基本上一个前端人员能值多少大洋,就看JS了.虽然各种框架层出不穷,但是归根结底学好原生JS才是硬道理. 学习任何新东西其实都遵循 10000 小时成 ...
- linux下使用Android studio启动模拟器时提示 waiting for target device to come online 的问题
方法来自:http://stackoverflow.com/questions/42612468/how-can-i-get-more-information-about-waiting-for-ta ...
- Sql Server 优化----SQL语句的执行方式与锁以及阻塞的关系
阻塞原因之一是不同的Session在访问同一张表的时候因为不兼容锁的原因造成的, 当前执行的SQL语句是否被阻塞(或者死锁),不仅跟当前表上的已有的锁有关,也会跟当前执行的SQL语句的执行方式有关 简 ...
- 3rd 逻辑运算符的基本用法
03.01_Java语言基础(逻辑运算符的基本用法)(掌握) A:逻辑运算符有哪些 &,|,^,! &&,|| B:案例演示 逻辑运算符的基本用法 注意事项: a:逻辑运算符一 ...
- tomcat注册windows服务
1,首先查看当前window服务中是否已经存在同名服务.查看方法: 在服务列表里查看有没有Apache 或tomcat相关的服务, 如果有的话,请在上面点鼠标右键--->属性,记下此服务的名称, ...
- PCL:PCL与MFC 冲突总结
(1):max,min问题 MFC程序过程中使用STL一些类编译出错,放到Console Application里一切正常.比如: void CMyDialog::OnBnClickedButton1 ...
- vc++实例创建简单窗体
#include<windows.h>#include<stdio.h>LRESULT CALLBACK WinSunProc(HWND hwnd,UINT uMsg,WPAR ...
- MongoDB基本操作总结
MongoDB语法总结:插入操作:单条插入语法 : insertOne()示例: db.getCollection('MY_TEST').insertOne({"日期" : &qu ...