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年才是其真正进入主流市场的元年,最近国内大量 ...
随机推荐
- 常用的wsdl地址
天气预报Web Service,数据来源于中国气象局 Endpoint Disco WSDL IP地址来源搜索Web Service(是目前最完整的IP地址数据) Endpoint Disco WSD ...
- 动态可视化库Vis.js:社交关系谱
Form Here:http://code.csdn.net/news/2819345 Vis.js 是一个动态的.基于浏览器的可视化库,可处理大量的动态数据并能与这些数据进行交互操作.该项目是由Al ...
- linux之SQL语句简明教程---INSERT INTO
到目前为止,我们学到了将如何把资料由表格中取出.但是这些资料是如果进入这些表格的呢? 这就是这一页 (INSERT INTO) 和下一页 (UPDATE) 要讨论的. 基本上,我们有两种作法可以将资料 ...
- linux之SQL语句简明教程---AND OR
在上一页中,我们看到 WHERE 指令可以被用来由表格中有条件地选取资料. 这个条件可能是简单的 (像上一页的例子),也可能是复杂的.复杂条件是由二或多个简单条件透过 AND 或是 OR的连接而成.一 ...
- python-django如何在sae中使用自带ImageField和FileField -django-上善若水小站
python-django如何在sae中使用自带ImageField和FileField -django-上善若水小站 python-django如何在sae中使用自带ImageField和FileF ...
- UVA 489-- Hangman Judge(暴力串处理)
Hangman Judge In ``Hangman Judge,'' you are to write a program that judges a series of Hangman gam ...
- mac 安装maven 和改动java环境变量
一. 首先是安装maven: 步骤: 1.下载Maven tar包 http://maven.apache.org/download.cgi 2. 下载后解压到某个目录下 [html] view pl ...
- mysql基础:mysql与C结合实例
一个简单的mysql与C的交互,使用了一些mysql的C API! 老鸟掠过,新手能够看看! /****************************************** 本文件学习mysq ...
- 网络配置——Linux运维基础
今天把Linux的网络配置总结了一下,尽管并不难可是是个比較重要的基础.然后我也不知到自己以后是否会做运维,可是我知道自己比較喜欢刨根问底.还有就是我很珍惜我以前掌握过的这些运维的技能.今天突然间问自 ...
- hdu 4712 Hamming Distance ( 随机算法混过了 )
Hamming Distance Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others) ...