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 ...
随机推荐
- [XJOI]noip44 T3还有这种操作
还有这种操作 ttt 最近在学习二进制, 他想知道小于等于N的数中有多少个数的二进制表示中有偶数个1. 但是他想了想觉得不够dark,于是他增加了若干次操作,每次操作会将一个区间内的0变1 , 1变0 ...
- linux下恢复被删除的文件
https://cloud.tencent.com/developer/article/1028317
- ADO.NET增删改
static void Main1(string[] args) {添加造连接字符串string connstring = "server=.;database=mydb;user=sa;p ...
- 让.bashrc文件在终端自动生效
修改了.bashrc文件,想在打开终端时默认路径变成桌面路径.代码如下 cd ~/desktop export PATH="/Users/nola/local:$PATH" 但是每 ...
- VueJS 开发常见问题集锦
由于公司的前端开始转向 VueJS,最近开始使用这个框架进行开发,遇到一些问题记录下来,以备后用. 主要写一些 官方手册 上没有写,但是实际开发中会遇到的问题,需要一定知识基础. 涉及技术栈 CLI: ...
- Java基础5一数组的常见应用算法
常用算法 1.冒泡排序: 原理:比较两个相邻的元素,将值大的元素交换至右端 示例: public static void bubbleSort(int[] a) { int n = a.length; ...
- 【转载】java调用C++写的DLL
用java调用C++写的DLL一直以来都是一个比较麻烦但又很常见的问题. 我们知道,使用 JNI 调用 .dll/.so 共享类库是非常非常麻烦和痛苦的. 如果有一个现有的 .dll/.so 文件,如 ...
- spring cloud(二) zuul
spring cloud 网关 zuul 搭建过程 1. 新建boot工程 pom引入依赖 <dependency> <groupId>org.springframework. ...
- VS Code编写html(2)
<html> <head> <title>welcome to myspace</title> <meta charset="utf-8 ...
- python的jieba分词
# 官方例程 # encoding=utf-8 import jieba seg_list = jieba.cut("我来到北京清华大学", cut_all=True) print ...