CCPC L(水)
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'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 ...
- 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 ...
随机推荐
- C#反序列化json字符串时,提示:应为来自命名空间“”的元素“root”。。遇到名称为“”、命名空间为“”的“None”。
反序列化调用接口返回的字符串时,出现:应为来自命名空间“”的元素“root”..遇到名称为“”.命名空间为“”的“None”.,导致反序列化数据失败,这种失败并有时候并不会直接提示反序列化失败(抛异常 ...
- java面向对象之 类和对象
OOP:Object Oriented Programming(面向对象编程) 面向对象: 1:将复杂的事情简单化. 2:面向对象将以前的过程中的执行者,变成了指挥者. 3:面向对象这种思想是符合现在 ...
- 简单介绍一下ODI的几个基本概念
简单介绍一下ODI的几个基本概念 ODI的几个基本概念是本文我们主要要介绍的内容,接下来我们就开始介绍这一过程,一起来看看吧! 什么是资料库 ODI资料库可安装在任何支持ANSIISO89的数据库 ...
- mysqldump 利用rr隔离实现一致性备份
mysqldump -p -S /data/mysqldata1/sock/mysql.sock --single-transaction --master-data=2 --database db1 ...
- QT与JavaScript互调 - 虹的日志 - 网易博客
QT与JavaScript互调 - 虹的日志 - 网易博客 QT与JavaScript互调 2012-05-29 21:43:14| 分类: 技术 | 标签:qt javascript w ...
- [置顶] 【GBT28181开发:SIP协议实践】之设备远程启动
下面学习的是设备远程控制的流程,和设备信息.设备目录.设备状态的流程差不多,主要是描述的协议字段不同,模拟SPVMN系统向源设备发送远程启动控制指令,记录下交互的消息,详细研究了下: 转载请注明出处: ...
- [置顶] jsp中c标签的使用
jsp中c标签的使用 核心标签库 它是JSTL中的核心库,为日常任务提供通用支持,如显示和设置变量.重复使用一组项目.测试条件和其他操作(如导入和重定向Web内容).Core标签按功能可分为4种类型: ...
- ASP.NET关于Eval的值
ASP.NET邦定数据“<%#Eval("Sex")%>”运用三元运算符: <%#(Eval(") ? "男" : "女& ...
- [Swust OJ 409]--小鼠迷宫问题(BFS+记忆化搜索)
题目链接:http://acm.swust.edu.cn/problem/409/ Time limit(ms): 1000 Memory limit(kb): 65535 Description ...
- AC自动机妙用
理解题意之后,很自然的想到了用AC自动机搞,结果网上一搜,全是暴搜,按照自己的思想,AC自动机搞起,果然在提交了数次之后,看到了Accept. AC自动机需要三个步骤: 第一步:建立字典树: 第二步: ...