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
2
Case #1

题解:半信半疑的2*N-1就过了,好水;

代码:

 1 #include<stdio.h>
 2 int main(){
 3     int T,N,flot=0;
 4     scanf("%d",&T);
 5     while(T--){
 6         scanf("%d",&N);
 7         printf("Case #%d: %d\n",++flot,2*N-1);
 8     }
 9     return 0;
10 }
时间: 2024-12-20 08:17:40

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 doctor. He use identical bottles to carry the medicine. There are different types of medicine. Huatuo put medicines into the bottles and chain these b

2017 UESTC Training for Data Structures

2017 UESTC Training for Data Structures A    水,找区间极差,RMQ怼上去. #include<bits/stdc++.h> using namespace std; #pragma comment(linker, "/STACK:102400000,102400000") #define rep(i,a,b) for (int i=a;i<=b;i++) #define per(i,b,a) for (int i=b;i&

AHU 周末练习 题解

=.= 这次比赛乱搞题比较多..做的时候也比较烦躁..感觉效率不是很高. A: 水题,直接记录每个数字的位置然后输出就好了. B:  题目看半天才明白,其实就是考一个三进制转化,很水.. typedef long long LL; const int maxn = 1024; int numa[maxn], numc[maxn], numb[maxn]; int to3(LL num, int *str) { int len = 0; while(num) { str[len++] = num

加热水杯

package text; public class t20151014s { public static void main(String[] args) { // TODO Auto-generated method stub Shuibei Shuibei = new Shuibei("黑色","圆形",100);//实例化水杯 Shuibei.Shuiliang = 0;//引用Shuibei.java中的Shuiliang这个量,并对其进行赋值 Shuib

[Wikioi 1226]倒水问题

题目描述 Description 有两个无刻度标志的水壶,分别可装 x 升和 y 升 ( x,y 为整数且均不大于 100 )的水.设另有一水 缸,可用来向水壶灌水或接从水壶中倒出的水, 两水壶间,水也可以相互倾倒.已知 x 升壶为空 壶, y 升壶为空壶.问如何通过倒水或灌水操作, 用最少步数能在x或y升的壶中量出 z ( z ≤ 100 )升的水 来. 输入描述 Input Description 一行,三个数据,分别表示 x,y 和 z; 输出描述 Output Description 一

PPM

ppm ppm可以用在质量上,一公斤(kg)的物质中有一毫克(mg)某物质,某物质含量即为1ppm: 也可用在容量上,一千升(kL)的溶液中有一毫升(mL)的某物质,某物质含量即为1ppm: 也可以质量和容量一起用,一升的溶液中有某物质一毫克,某物质含量即为1ppm,这是因为以水来说,一升(L)水的重量为一千克,一千克比上一毫克的比值刚好是一百万分之一,也就是1ppm = 1 mg/L. 实际上,ppm是指part per million,同理b,t分别表示billion和trillion:严格

百度好几个市房管局开始开发了开始

http://www.ebay.com/cln/yi_ch32/book/167329925017/20150205 http://www.ebay.com/cln/gozh754/book/167427188010/20150205 http://www.ebay.com/cln/guamyz-peuhck/book/167535329016/20150205 http://www.ebay.com/cln/nito098/book/167427189010/20150205 http://w

codeforces Gym 100187L L. Ministry of Truth 水题

L. Ministry of Truth Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/problem/K Description Andrey works in the Ministry of Truth. His work is changing articles in newspapers and magazines so that they praise the Party an

Android L中水波纹点击效果的实现

博主参加了2014 CSDN博客之星评选,帮我投一票吧. 点击给我投票 前言 前段时间android L(android 5.0)出来了,界面上做了一些改动,主要是添加了若干动画和一些新的控件,相信大家对view的点击效果-水波纹很有印象吧,点击一个view,然后一个水波纹就会从点击处扩散开来,本文就来分析这种效果的实现.首先,先说下L上的实现,这种波纹效果,L上提供了一种动画,叫做Reveal效果,其底层是通过拿到view的canvas然后不断刷新view来完成的,这种效果需要view的支持,