2015南阳CCPC L - Huatuo's Medicine 水题
L - Huatuo's Medicine
Time Limit: 1 Sec
Memory Limit: 256 MB
题目连接
无
Description
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
Output
one line containing Case #x:, where x is the test case number (starting
from 1). Then output 4 lines with 4 characters each. indicate the
recovered board.
Sample Input
1
2
Sample Output
Case #1: 3
HINT
题意
华佗有n种药,让你构成一条最短的链,他能够在黑暗中也能找到自己想找到的药品
题解:
对称就好了,例如:D-C-B-A-B-C-D
所以答案2n-1
代码:
#include<iostream>
#include<stdio.h>
using namespace std; int main()
{
int t;scanf("%d",&t);
for(int cas = ;cas <= t;cas ++)
{
int n;scanf("%d",&n);
printf("Case #%d: %d\n",cas,*n-);
}
}
2015南阳CCPC L - Huatuo's Medicine 水题的更多相关文章
- 2015南阳CCPC L - Huatuo's Medicine 签到
L - Huatuo's Medicine Description Huatuo was a famous doctor. He use identical bottles to carry the ...
- 2015南阳CCPC A - Secrete Master Plan 水题
D. Duff in Beach Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description Master Mind KongMing gave ...
- 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 ...
- codeforces Gym 100187L L. Ministry of Truth 水题
L. Ministry of Truth Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/p ...
- 2015南阳CCPC D - Pick The Sticks dp
D - Pick The Sticks Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description The story happened lon ...
- 2015南阳CCPC C - The Battle of Chibi DP
C - The Battle of Chibi Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description Cao Cao made up a ...
- 2015南阳CCPC D - Pick The Sticks 背包DP.
D - Pick The Sticks Description The story happened long long ago. One day, Cao Cao made a special or ...
- 「2015南阳CCPC D」金砖 解题报告
金砖 Problem 有一个长度为L的板凳,可以放一排金砖,金砖不能重叠.特别的,摆放的金砖可以超出板凳,前提是必须保证该金砖不会掉下去,即该金砖的重心必须在板凳上. 每块金砖都一个长度和价值,且金砖 ...
- 2015南阳CCPC E - Ba Gua Zhen 高斯消元 xor最大
Ba Gua Zhen Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description During the Three-Kingdom perio ...
随机推荐
- <四>面向对象分析之UML核心元素之用例
一:基本概念 --->用例定义了一组用例实例,其中每个实例都是系统所执行一系列操作,这些操作生成特定主角可以观测的值. --->所谓用例,就是一件事情,要完成这 ...
- 应用emailAutoComplete.js来自动显示邮箱后缀列表
我们经常有邮箱的人都特别清楚,在输入我们的邮箱时,会自动显示出邮箱后缀列表,这个用户体验是不错的. 操作据悉——当我们输入文字时,会自动有个邮箱后缀名的列表. 而我这边的代码是,应用jque ...
- Delphi DecodeDate和EncodeDate 拆分和聚合时间函数的用法
SysUtilsprocedure DecodeData(Date: TDateTime; var Year, Month, Day: Word);DecodeDate打断TdateTime成为年月日 ...
- firebug console使用
Firebug内置一个console对象,提供5种方法,用来显示信息. console.log("Hello World") console.info("这是info&q ...
- Linux基本命令(5)管理使用者和设立权限的命令
管理使用者和设立权限的命令 命令 说明 命令 说明 chmod 用来改变权限 useradd 用来增加用户 su 用来修改用户 5.1 chmod命令 chmod命令用来改变许可权限.读取.写 ...
- Android自带CalendarView类实现日历视图
文章由来:学习一下日历控件的实现,Android3.0以下的版本请查阅其他文章. 本文主要是介绍Android日历视图控件CalendarView相关的内容,然后在后面会给出一个简单的Demo. Ca ...
- 【原】Storm Tutorial
Storm入门教程 1. Storm基础 Storm Storm主要特点 Storm基本概念 Storm调度器 Storm配置 Guaranteeing Message Processing(消息处理 ...
- Codevs No.1553 互斥的数
2016-05-31 21:34:15 题目链接: 互斥的数 (Codevs No.1553) 题目大意: 给N个数,如果其中两个数满足一个数是另一个的P倍,则称它俩互斥,求一个不互斥集合的最大容量 ...
- CentOS安装XRDP实现远程桌面访问
1.配置环境: yum install gcc pam-devel openssl-devel -y 2.进入指定目录下载并解压xrdp: 先安装 wget; sudo yum -y install ...
- 【转】Maven实战(二)---多模块开发---缺少Jar包
原博文出于:http://blog.csdn.net/liutengteng130/article/details/41611755 感谢! Maven里面的Jar包经常出现Missing的情况 ...