HDU 5551 Huatuo's Medicine(宇宙无敌炒鸡大水题)

╰+攻爆jí腚メ 2022-06-08 08:13 251阅读 0赞

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 A and B B, he will put A A into one bottle and put B B into two bottles. Then he will chain the bottles in the order of ′−B−A−B−′ ′−B−A−B−′. In this way, when he arrived the patient’s home, he knew that the bottle in the middle is medicine A A and the bottle on two sides are medicine B B.

Now you need to help Huatuo to work out what’s the minimal number of bottles needed if he want to bring N N types of medicine.

Input

The first line of the input gives the number of test cases, T(1≤T≤100) T(1≤T≤100). T T lines follow. Each line consist of one integer N(1≤N≤100) 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 x is the test case number (starting from 1) and y y is the minimal number of bottles Huatuo needed.

Sample Input

  1. 1
  2. 2

Sample Output

  1. Case #1: 3

题解:

水到完全不想写题解,好久没写日志了凑几篇

贴诗:

丁巳重阳前三日,梦亡妇淡装素服,执手哽咽,语多不复能记。但临别有云:“衔恨愿为天上月,年年犹得向郎圆。”妇素未工诗,不知何以得此也,觉后感赋。

瞬息浮生,薄命如斯,低徊怎忘。记绣榻闲时,并吹戏雨;雕阑曲处,同倚斜阳。梦好难留,诗残莫续,赢得更深哭一场。遗容在,只灵飙一转,未许端详。

重寻碧落茫茫。料短发、朝来定有霜。便人间天上,尘缘未断;春花秋叶,触绪还伤。欲结绸缪,翻惊摇落,减尽荀衣昨日香。真无奈,倩声声邻笛,谱出回肠。

——纳兰容若《沁园春》

代码:

  1. #include<iostream>
  2. #include<cstring>
  3. #include<stdio.h>
  4. #include<math.h>
  5. #include<string>
  6. #include<stdio.h>
  7. #include<queue>
  8. #include<stack>
  9. #include<map>
  10. #include<vector>
  11. #include<deque>
  12. #include<algorithm>
  13. #define ll long long
  14. #define INF 100861111
  15. #define M (t[k].l+t[k].r)/2
  16. #define lson k*2
  17. #define rson k*2+1
  18. using namespace std;
  19. int main()
  20. {
  21. int i,j,test,q,n;
  22. scanf("%d",&test);
  23. for(q=1;q<=test;q++)
  24. {
  25. scanf("%d",&n);
  26. printf("Case #%d: %d\n",q,n*2-1);
  27. }
  28. return 0;
  29. }

发表评论

表情:
评论列表 (有 0 条评论,251人围观)

还没有评论,来说两句吧...

相关阅读

    相关 宇宙无敌大招呼 (5 分)

    宇宙无敌大招呼 (5 分) 据说所有程序员学习的第一个程序都是在屏幕上输出一句“Hello World”,跟这个世界打个招呼。作为天梯赛中的程序员,你写的程序得高级一点,

    相关 1074 宇宙无敌加法器(JAVA)

    地球人习惯使用十进制数,并且默认一个数字的每一位都是十进制的。而在 PAT 星人开挂的世界里,每个数字的每一位都是不同进制的,这种神奇的数字称为“PAT数”。每个 PAT 星人

    相关 推荐你读

    《算法导论》 我是大一参加ACM竞赛的时候买的《算法导论》,这本书内容聚合度高,比如一个排序算法,就有八九种,每一种都详细描述了算法流程,时间与空间复杂度。 我也没能够

    相关 7-2 宇宙无敌大招呼

    据说所有程序员学习的第一个程序都是在屏幕上输出一句 “Hello World”,跟这个世界打个招呼。作为天梯赛中的程序员,你写的程序得高级一点,要能跟任意指定的星球打招呼。