There are n people (excluding myself) in my 30th birthday party. They sing the traditional “happy birthday” song:
Happy birthday to you! Happy birthday to you! Happy birthday to Rujia! Happy birthday to you!!!
    Since I love music, I want to hear something more interesting, not that everyone sings together. Ah yes, I want one person to sing one word!
    For example, there are three people: Mom, Dad, Girlfriend, I’d like them to sing like this:
Mom: Happy
Dad: birthday
Girlfriend: to
Mom: you
Dad: Happy
Girlfriend: birthday
Mom: to
Dad: you
Girlfriend: Happy
Mom: birthday
Dad: to
Girlfriend: Rujia
Mom: Happy
Dad: birthday
Girlfriend: to
Mom: you
    Very nice, right? What if there are more than 16 people? That’s easy: repeat the song until everyone has sung at least once ?
    Please, don’t stop in the middle of the song.
Input
There is only one test case. The first line contains a single integer n (1 ≤ n ≤ 100). Then each of the next n lines contains a capitalized name (i.e. one upper-case letter followed by zero or more lowercase letters). Each name contains at most 100 characters and do not have whitespace characters inside.
Output
Output the song, formatted as above.
Sample Input
3
Mom
Dad
Girlfriend
Sample Output
Mom: Happy
Dad: birthday
Girlfriend: to
Mom: you
Dad: Happy
Girlfriend: birthday
Mom: to
Dad: you
Girlfriend: Happy
Mom: birthday
Dad: to
Girlfriend: Rujia
Mom: Happy
Dad: birthday
Girlfriend: to
Mom: you

问题链接:UVA12554 A Special “Happy Birthday” Song!!!
问题简述:(略)
问题分析
    唱生日快乐歌,若人数少于16人则每人一句接下去,重复唱,直到歌曲唱完。若人数超过16人则每人至少唱一句,唱完正首歌,中途不停下。
    简单题不解释。计算公式写法值得借鉴。
程序说明:(略)
参考链接:(略)
题记:(略)

AC的C++语言程序如下:

/* UVA12554 A Special "Happy Birthday" Song!!! */#include <bits/stdc++.h>using namespace std;const int W = 16;
const int WN = 4;
string word[] = {"Happy", "birthday", "to", "you"};
const int N = 100;
string name[N];int main()
{int n;cin >> n;for(int i = 0; i < n; i++)cin >> name[i];int k = (n <= W ? W : (n + W - 1) / W * W);for(int i = 0; i < k; i++)cout << name[i % n] << ": " << (i % 16 == 11 ? "Rujia" : word[i % WN]) << endl;return 0;
}

UVA12554 A Special Happy Birthday Song!!!【水题】相关推荐

  1. Sicily 2012 King[Special judge] (不是水题胜似水题)

    题目的意思是:在这个柔弱强食的年代,能打架才是王道,打架最强才能称霸天下 给你1000个人 如果A打赢B,那么A可以傲视B 如果A打赢B,B能打赢C,那么A可以傲视C 问你谁能傲视群雄? 这个题很容易 ...

  2. 水题/poj 1852 Ants

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

  3. HDU2673-shǎ崽(水题)

    如果不能够直接秒杀的题,就不算水题.又应证了那句话,有时候,如果在水题上卡住,那么此题对于你来说,也就不算是水题了额~~ 刚睡醒,迷迷糊糊. 题目的意思很简单,求一个最大的,再求一个最小的.几乎是什么 ...

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

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

  5. 图论刷水题记录(一)(最短路-----dijkstra算法)

    最近实在不知道干些什么,感觉自己除了水题什么都不会做,算了去刷一刷图论的水题吧本来想合起来一起发,想了想太长的话以后看起来也不方便,题目所以今天晚上就先发了dij部分,由上到下由易变难. 1.POJ ...

  6. hdu 2041:超级楼梯(水题,递归)

    超级楼梯Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submissio ...

  7. HDU2568 前进【水题】

    前进 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submiss ...

  8. CF Round #426 (Div. 2) The Useless Toy 思维 水题

    题目链接: http://codeforces.com/contest/834/problem/A 题目描述: 输入起始状态和结束状态和数列长度, 判断旋转方向是顺时针逆时针还是不合理 解题思路: 长 ...

  9. NUC1312 Sum【水题+数学题】

    Sum 时间限制: 1000ms 内存限制: 65536KB 通过次数: 1总提交次数: 1 问题描述 认为自然数是从1-N.将每个数和+或-联系起来,然后计算这个表达式的值我们得到一个和S.这个问题 ...

最新文章

  1. 一些思考,没想好标题
  2. 常用的linux故障,Linux下常用的故障排查命令行
  3. CSS学习笔记-04 a标签-导航练习
  4. python 二叉树递归时明明已经得到了结果,但是返回None
  5. 支付宝回应老年版相互宝质疑:5万、10万互助金额度是合理区间
  6. Iphone革了谁的命?
  7. ZWrite 和ZTest
  8. android源码学习之源码编译并nexus s真机刷机
  9. catia快捷键_CATIA的管理员模式和多版本环境变量设置
  10. Google搜索打不开解决办法、Chrome小技巧
  11. 【UVA11478】Halum (最短路解差分约束)
  12. doolittle分解法解线性方程
  13. Java金额转换工具类
  14. 官方资料:Oracle 10g DBA 学习手册(精心整理,申请加精)
  15. 输入一个字符,判断输入的是控制字符、数字、大小写字母还是其他字符,并给出相应提示
  16. 合肥计算机函授专业,2015年想学电脑,合肥哪个学校比较好点,中国计算机函授学院怎么样?...
  17. etermPID配置放大软件下载使用部署
  18. Jmeter-PerfMon Metrics Collector监控解析
  19. mysql创建用户表单_mysql创建用户并赋权
  20. 《天池龙珠 - SQL训练营》02.SQL基础:查询与排序-select、运算符、聚合分组查询等

热门文章

  1. 2018-09-29 摘抄eDP取代LVDS视频接口
  2. SQL那些事儿(十三)--Oracle中varchar与varchar2区别
  3. Kubernetes的Service外部访问方式:NodePort和LoadBalancer
  4. C#Socket通讯之超时检测
  5. zabbix监控mysql内存_zabbix通过自定义脚本监控nginx,php-fpm和mysql占用内存数和进程的个数...
  6. linux普通用户id一般是,实际用户ID和有效用户ID (一) *****
  7. 【java学习之路】(java SE篇)003.java SE基础语法之数组
  8. Hive的三种建表方式
  9. 市场营销分析--页面广告统计
  10. 内核参数 linux dd,Linux dd 命令详解(测磁盘的吞吐量)