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 ...
随机推荐
- 如何使用 orachk 工具
Oracle RAC 安装完毕后的健壮性是一个令人头疼的问题.之前Oracle为之专门推出了raccheck工具,确实方便了我们这些个苦逼的DBA.现在Oracle在raccheck的基础之上又推出了 ...
- Android开发中常见的设计模式
对于开发人员来说,设计模式有时候就是一道坎,但是设计模式又非常有用,过了这道坎,它可以让你水平提高一个档次.而在android开发中,必要的了解一些设计模式又是非常有必要的.对于想系统的学习设计模式的 ...
- mvc项目,导出到Excel,中文显示乱码
1 public class HomeController : Controller 2 { 3 static List<User> GetUsers() 4 { 5 List< ...
- 【LeetCode 207】Course Schedule
There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prer ...
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之 get_selected_list_value(self, locator)
def get_selected_list_value(self, locator): """Returns the value of the selected elem ...
- 用duilib制作仿QQ2013动态背景登录器
转载请说明原出处,谢谢~~ 在上一篇博客里,我修复了CActiveXUI控件的bug,从而可以使用flash动画来制作程序的背景,这篇博客说明一下应该怎么使用CActiveXUI控件创建透明无窗体的背 ...
- android测试本地服务调试流程
我今天调试的整个过程 1,安卓发现连不上本地的tomcat 2,使用浏览器直接尝试,发现可以连上 3,怀疑是安卓APP和浏览器访问有差异,后上网搜索不到APP,只有浏览器尝试 再不就是改I ...
- 理解CSS盒子模型
概述 网页设计中常听的属性名:内容(content).填充(padding).边框(border).边界(margin),CSS盒子模型都具备这些属性,也主要是这些属性. 这些属性我们可以把它转移到我 ...
- C语言反转字符串
也是面腾讯的一道编程题=,= 这题比较简单 代码如下: #include <stdio.h> #include <string.h> // 非递归实现字符串反转 char *r ...
- nodejs 5.2.0文档自翻译——HTTP模块
HTTP Class: http.Agent new Agent([options]) agent.destroy() agent.freeSockets agent.getName(options) ...