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 ...
随机推荐
- 使用数组实现ArrayList的效果
package day04.d2.shuzu; /** * 通过数组实现类似于集合的功能 * 包含功能有: * * 动态添加元素 * 在指定位置添加元素 * * 删除指定下标的元素 * 删除指定内容的 ...
- C# How to convert MessageBodyStream to MemoryStream?
通过WCF服务从数据库取文档数据时,返回的是Stream对象,在DevExpress的PDFViewer显示时,用PDFViewer.LoadDocunent(Stream stream);方法时,报 ...
- 自制滑杆slider
一.效果图 二.HTML结构 <div id="d2"> <p>自制可拖动滑块:</p> <div id="out"& ...
- poj1111 Image Perimeters 广搜
题目大意: 输入一个矩阵,再输入其中一个“X”的位置(从1开始).从该位置向八个方向扩展,如果是“X”就可以并在一起.问最后得到的模块的周长是多少. 解题思路: 按照广搜的思路来做.用一个二维的数组标 ...
- java线程入门知识
为什么需要多线程? . 模型的简化,如某些程序是由多个相对独立任务的运行: . 图形界面的出现,输入.输出的阻塞 . 多核CPU的更好利用 . 异步行为的需要 Java多线程的特性: . 程序的入口m ...
- 把pcl的VTK显示融合到MFC(代码找原作者)
转自PCL中国,原文链接:http://www.pclcn.org/bbs/forum.php?mod=viewthread&tid=223&extra=page%3D1 本人做了少量 ...
- WebLogic安装使用及常见问题
WebLogic的下载与安装 下载地址: http://www.oracle.com/technetwork/middleware/weblogic/downloads/index.html fmw_ ...
- Java中 ArrayList类的使用
java.util.ArrayList 是大小可变的数组的实现,存储在内的数据称为元素.此类提供一些方法来操作内部存储 的元素. ArrayList 中可不断添加元素,其大小也自动增长. ArrayL ...
- hibernate简单集合映射和获取
简单集合映射(可以直接获取) // javabean设计 public class User { private int userId; private String userName; // 一个用 ...
- TensorFlow实战学习笔记(14)------VGGNet
一.VGGNet:5段卷积[每段有2~3个卷积层+最大池化层][每段过滤器个数:64-128-256-512-512] 每段的2~3个卷积层串联在一起的作用: 2个3×3的卷积层串联的效果相当于一个5 ...