BNUOJ27873:A Special "Happy Birthday" Song!!!
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 lower-case 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
Output for the Sample Input
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
Rujia Liu's Present 6: Happy 30th Birthday to Myself
Special Thanks: All of you, for participating in this contest; Mom and Dad, for giving birth to me :)
题意很简单,就是N个人,没人唱一次歌词,如果人数多于16,则重复
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std; char name[105][105];
char song[16][16] = {"Happy","birthday","to","you","Happy","birthday","to","you","Happy","birthday","to","Rujia","Happy","birthday","to","you"}; int main()
{
int n,i,j,k;
while(~scanf("%d",&n))
{
for(i = 0; i<n; i++)
scanf("%s",name[i]);
k = n/16;
if(n%16)
k++;
for(i = 0; i<16*k; i++)
printf("%s: %s\n",name[i%n],song[i%16]);
} return 0;
}
BNUOJ27873:A Special "Happy Birthday" Song!!!的更多相关文章
- PhpCMS标签:专题模块special标签
专题模块 专题模块PC标签调用说明 模块名:special 模块提供的可用操作 操作名 说明 lists 专题列表 content_list 专题信息列表 hits 专题信息点击排序 下面对所有的操作 ...
- CSS样式----图文详解:css样式表和选择器
主要内容 CSS概述 CSS和HTML结合的三种方式:行内样式表.内嵌样式表.外部样式表 CSS四种基本选择器:标签选择器.类选择器.ID选择器.通用选择器 CSS三种扩展选择器:组合选择器.后代选择 ...
- poj-3739. Special Squares(二维前缀和)
题目链接: I. Special Squares There are some points and lines parellel to x-axis or y-axis on the plane. ...
- Akka(33): Http:Marshalling,to Json
Akka-http是一项系统集成工具.这主要依赖系统之间的数据交换功能.因为程序内数据表达形式与网上传输的数据格式是不相同的,所以需要对程序高级结构化的数据进行转换(marshalling or se ...
- Akka(40): Http:Marshalling reviewed - 传输数据序列化重温
上篇我们讨论了Akka-http的文件交换.由于文件内容编码和传输线上数据表达型式皆为bytes,所以可以直接把文件内容存进HttpEntity中进行传递.那么对于在内存里自定义的高级数据类型则应该需 ...
- 1.5 Scipy:高级科学计算
sklearn实战-乳腺癌细胞数据挖掘(博主亲自录制视频教程) https://study.163.com/course/introduction.htm?courseId=1005269003&am ...
- JMeter学习篇(一):测试实例讲解
1.JMeter的下载与安装 Jmeter官方下载地址:http://jmeter.apache.org/download_jmeter.cgi,下载jmeter是一个zip压缩包,解压后,直接运行a ...
- 痞子衡嵌入式:盘点国内RISC-V内核MCU厂商
大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是国内RISC-V内核MCU厂商. 虽然RISC-V风潮已经吹了好几年,但2019年才是其真正进入主流市场的元年,最近国内大量芯片公司崛起 ...
- 痞子衡嵌入式:盘点国内RISC-V内核MCU厂商(2020年发布产品)
大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是国内RISC-V内核MCU厂商(2020). 虽然RISC-V风潮已经吹了好几年,但2019年才是其真正进入主流市场的元年,最近国内大量 ...
随机推荐
- 【UVA 10307 Killing Aliens in Borg Maze】最小生成树, kruscal, bfs
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=20846 POJ 3026是同样的题,但是内存要求比较严格,并是没有 ...
- poj 1458 Common Subsequence_最长公共子串
题意:略 求最长公共子串 #include<iostream> #include<cstdio> #include<string> using namespace ...
- HDU 4721 Food and Productivity (二分+树状数组)
转载请注明出处,谢谢http://blog.csdn.net/ACM_cxlove?viewmode=contents by---cxlove 题意 :给出n * m的格子,每个格子有两个属性f ...
- 解决ZBarSDK 中文出现乱码
使用ZBarSDK进行二维码解释时出现乱码是因为ZBarSDK在解释时使用的字符集不对,需在ZBarSDK的源码中更正. 1.可以到http://sourceforge.net/p/zbar/_lis ...
- hdu 5607 graph (矩阵乘法快速幂)
考虑一个经典的问题: 询问从某个点出发,走 k 步到达其它各点的方案数? 这个问题可以转化为矩阵相乘,所以矩阵快速幂即可解决. 本题思路: 矩阵经典问题:求从i点走k步后到达j点的方案数(mod p) ...
- 三十、Java图形化界面设计——布局管理器之BorderLayout(边界布局)
边界布局管理器把容器的的布局分为五个位置:CENTER.EAST.WEST.NORTH.SOUTH.依次相应为:上北(NORTH).下南(SOUTH).左西(WEST).右东(EAST),中(CENT ...
- ./configure: error: the HTTP rewrite module requires the PCRE library
docker中CentOS安装nginx出错,提示没有PCRE,需要安装pcre-devel,同时还需要安装openssl.openssl-devel yum -y install pcre-deve ...
- ora-00600笔记
一. ORA-600 概述 Errorsof the form ORA-600 are called internal errors. This section clarifies themisund ...
- [Linked List]Reverse Nodes in k-Group
Total Accepted: 48614 Total Submissions: 185356 Difficulty: Hard Given a linked list, reverse the no ...
- Mysql安全机制
在mysql下mysql库中有6个权限表 mysql.user 用户字段,权限字段,安全字段,资源控制字段 mysql.db . mysql.host 用户字段,权限字段 mysql.tables_p ...