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

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.

Output

For each test case, 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

12

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 = 1;cas <= t;cas ++){int n;scanf("%d",&n);printf("Case #%d: %d\n",cas,2*n-1);}
}

2015南阳CCPC L - Huatuo's Medicine 水题相关推荐

  1. 2015南阳CCPC E - Ba Gua Zhen 高斯消元 xor最大

    Ba Gua Zhen Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description During the Three-Kingdom perio ...

  2. 南阳acm-206-矩形的个数(水题)

    矩形的个数 时间限制:1000 ms  |  内存限制:65535 KB 难度:1 描述 在一个3*2的矩形中,可以找到6个1*1的矩形,4个2*1的矩形3个1*2的矩形,2个2*2的矩形,2个3*1 ...

  3. [蓝桥杯2015决赛]分机号-枚举(水题)

    题目描述 X老板脾气古怪,他们公司的电话分机号都是3位数,老板规定,所有号码必须是降序排列,且不能有重复的数位. 比如:751,520,321 都满足要求,而766,918,201 就不符合要求. 现 ...

  4. [蓝桥杯2015决赛]积分之迷-枚举(水题)

    题目描述 小明开了个网上商店,卖风铃.共有3个品牌:A,B,C. 为了促销,每件商品都会返固定的积分. 小明开业第一天收到了三笔订单: 第一笔:3个A + 7个B + 1个C,共返积分:315 第二笔 ...

  5. 水题/poj 1852 Ants

    1 /* 2 PROBLEM:poj1852 3 AUTHER:Nicole 4 MEMO:水题 5 */ 6 #include<cstdio> 7 using namespace std ...

  6. 图论刷水题记录(二)(最短路-----SPFA算法)

    继第一篇的后续,又来刷水题了,写的是SPFA算法,这个算法的复杂度比较玄学,感觉能不用就不用了,但是他的好处就是可以判断负圈. 3月26日: 1.POJ 1847 Tram 题意:在一个交通网络上有N ...

  7. 【bzoj3524】【Poi2014】【Couriers】可持久化线段树(主席树)水题

    [pixiv] https://www.pixiv.net/member_illust.php?mode=medium&illust_id=62485671 向大(hei)佬(e)势力学(di ...

  8. hdu5007 小水题

    题意:       给你一个串,如果出现子串 "Apple", "iPhone", "iPod", "iPad"输出MA ...

  9. hdu4287 水题

    题意:          水题,就是给你一些单词,和一些按键记录,问打出下面的那些单词,每一个按键记录一共按了多少次. 思路:       直接把每个单词的每一位转换成数字,然后再把每个单词转换的数字 ...

最新文章

  1. python函数结构图_Python数据结构与算法之图结构(Graph)实例分析
  2. 《Python数据科学指南》——1.16 使用lambda创造匿名函数
  3. css响应式布局 兼容ie6
  4. 自定义的命民空间在其他程序集里无法调用
  5. 用户二次登陆,干掉第一次登录的session
  6. 云效 Flow——Java构建并通过云效上传二方库到 Maven 私有仓库
  7. python离线安装国内镜像OpenCV
  8. 工作335:uni-增加表单验证
  9. Oracle 1204 RAC failover 测试 (二)
  10. HDOJ 2955 Robberies (01背包)
  11. python课程设计
  12. docker mysql 主从配置
  13. dpkg: error processing package oracle-java8-installer (--configure):
  14. Linux 中 Iptables 规则定义
  15. Java多线程(二)——多线程基本特性
  16. php编程输出心形图案_如何用C语言先输出一段文字如何再输出心形图案?
  17. python通过txt文件将指定图片复制到另一个文件夹
  18. python中编完类后到实例编写_Python 和 JavaScript 的区别是什么?
  19. 【MyBatis框架】Lombok插件的安装及使用
  20. selenium安装和chromedriver下载安装

热门文章

  1. 共享可写节包含重定位_理解重定位
  2. python历史 用量 预测_用python做时间序列预测七:时间序列复杂度量化
  3. 使用effect的注意事项
  4. 获取服务器时间的软件如何修改时间,小程序云开发获取服务器时间
  5. php+彩票中奖判断,彩票算法 – PHP – 数学似乎不错,但功能是否有效?
  6. 语言const的生命周期_如何理解一门编程语言2——以复制构造函数为例
  7. java无法编译加载主类_JAVA编译完毕运行时错误找不到或无法加载主类
  8. 工作占用了太多私人时间_一本正经聊驾驶 | 汽车真的为我们节约时间了吗
  9. 高性能mysql 小查询_高性能MySQL06-查询优化(慢查询)
  10. java程序员技术_JAVA程序员需要懂得哪些技术