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 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 and output
Sample Input | Sample Output |
---|---|
1 |
Case #1 |
题解:半信半疑的2*N-1就过了,好水;
代码:
#include<stdio.h>
int main(){
int T,N,flot=;
scanf("%d",&T);
while(T--){
scanf("%d",&N);
printf("Case #%d: %d\n",++flot,*N-);
}
return ;
}
CCPC L(水)的更多相关文章
-
2015南阳CCPC L - Huatuo&#39;s Medicine 水题
L - Huatuo's Medicine Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description Huatuo was a famous ...
-
2015南阳CCPC L - Huatuo&#39;s Medicine 签到
L - Huatuo's Medicine Description Huatuo was a famous doctor. He use identical bottles to carry the ...
-
English trip V1 - B 20. Likes and Dislikes 喜欢和不喜欢 Teacher:Sole Key:
In this lesson you will learn to talk about likes and dislikes. 课上内容(Lesson) # talk about hobby Do y ...
-
2017 ACM/ICPC Asia Regional Guangxi Online 记录
题目链接 Guangxi 感觉这场比赛完全是读题场啊…… 比赛过程中丢失了一波进度,最后想开题的时候已经来不及了…… Problem A 按题意模拟……按照那个矩阵算就可以了 #include &l ...
-
[Wikioi 1226]倒水问题
题目描写叙述 Description 有两个无刻度标志的水壶.分别可装 x 升和 y 升 ( x,y 为整数且均不大于 100 )的水. 设另有一水 缸,可用来向水壶灌水或接从水壶中倒出的水, 两水壶 ...
-
Day 2:线程与进程系列问题(二)
补充: 线程的创建方式二: 1.自定义一个实现Runnable接口的类 2.实现Runnable接口中的run方法把自定义线程的任务写在run方法中 3.创建实现Runnable接口的对象 4.创建T ...
-
A distributional code for value in dopamine-based reinforcement learning
郑重声明:原文参见标题,如有侵权,请联系作者,将会撤销发布! Nature 2020 汇报PPT: 链接:https://pan.baidu.com/s/1RWx6miX6iZUNgNfV9B69FQ ...
-
JavaWeb 后端 <;二>; 之 Servlet 学习笔记
一.Servlet概述 1.什么是Servlet Servlet是一个运行在服务器端的Java小程序,通过HTTP协议用于接收来自客户端请求,并发出响应. 2.Servlet中的方法 public v ...
-
HTML5 3D 粒子波浪动画特效DEMO演示
需要thress.js插件: http://github.com/mrdoob/three.js // three.js - http://github.com/mrdoob/three.js ...
随机推荐
-
MySQL检查重复索引工具-pt-duplicate-key-checker
在MySQL中是允许在同一个列上创建多个索引的,示例如下: mysql --socket=/tmp/mysql5173.sock -uroot -p mysql> SELECT VERSION( ...
-
php中的常用数组函数(八) 排序函数汇总(sort、rsort、usort、asort、uasort、arsort、ksort、uksort、krsort、natsort、natcasesort、array_multisort)
测试环境:php5.3.29 sort_flags 可以用以下值改变排序的行为: 排序类型标记: SORT_REGULAR - 正常比较单元(不改变类型) SORT_NUMERIC - 单元被作为数字 ...
-
[RxJS] Completing a Stream with TakeWhile
Subscribe can take three params: subscribe( (x)=> console.log(x), err=> console.log(err), ()=& ...
-
C++字符串之一(字符表示)
在C++中有两种类型可以用于表示字符,char和wchar_t. 但是字符串格式的标准却有很多种,如ASCII,UTF8,UTF16,UTF32等等.字符串的格式和char/wchar_t 的关系是什 ...
-
HDOJ 3037 Saving Beans
如果您有n+1树,文章n+1埋不足一棵树m种子,法国隔C[n+m][m] 大量的组合,以取mod使用Lucas定理: Lucas(n,m,p) = C[n%p][m%p] × Lucas(n/p,m/ ...
-
How to install MySQL on CentOS
1)chekc centos中是否安装了MySQL [root@localhost MySQL]# rpm -qa | grep mariadb mariadb-libs-5.5.52-1.el7.x ...
-
the quick brown fox jumps over the lazy dog
THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
-
数据结构 之 并查集(Disjoint Set)
一.并查集的概念: 首先,为了引出并查集,先介绍几个概念: 1.等价关系(Equivalent Relation) 自反性.对称性.传递性. 如果a和b存在等价关系,记 ...
-
MFC Release版本串口连不上的问题
项目开发过程中发现Release版本存在连接串口时,第一次开机后,出现连接不上的问题,但在Debug版本下正常:而且只要连接上一次,Release版本就能正常连接: 解决方案: 在串口配置过程中更改为 ...
-
自然语言处理工具hanlp自定义词汇添加图解
过程分析 1.添加新词需要确定无缓存文件,否则无法使用成功,因为词典会优先加载缓存文件 2.再确认缓存文件不在时,打开本地词典按照格式添加自定义词汇. 3.调用分词函数重新生成缓存文件,这时会报一个找 ...