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年才是其真正进入主流市场的元年,最近国内大量 ...
随机推荐
- WIN_2003_SP2.iso VMware 不能进行网络访问的处理
1.打开IE发现不能上网的问题 ping命令 发现确实是网络不通: 2.关闭虚拟机设置网络适配器 3.ping命令验证是否设置成功 4.打开IE访问百度
- Windows.Server.2003.R2 简体中文企业版 x86 x64(转)
两张盘,第二张是 R2安装盘. Windows.Server.2003.R2.With.Sp2 中文企业版[MSDN官方版本][32bit] Windows 2003.R2.With.Sp2 简体中文 ...
- jquery.tablesorter.js 学习笔记
jquery.tablesorter.js 一般情况下,表格数据的排序方式有两种,第一种是让后端服务将排序后的数据直接输出,另外一种方式就是使用客户端排序,而jquery.tablesorter.js ...
- hdu 5616 Jam's balance(dp 正反01背包)
来自官方题解: AC代码: #pragma comment(linker, "/STACK:1024000000,1024000000") #include<iostream ...
- Redmine开启服务
写了一个启动Redmine的开机脚本,redmine文件在/etc/init.d/下 #!/bin/sh ### BEGIN INIT INFO # Provides: Dean Chen # Req ...
- google 推荐 android 像素统一使用dip,字体统一使用sp
像素统一使用dip,字体统一使用sp
- 【ThinkPHP学习】ThinkPHP自己主动转义存储富文本编辑器内容导致读取出错
RT. ThinkPHP的conf文件里的Convention.php有一个配置选项 'DEFAULT_FILTER' => 'htmlspecialchars', // 默认參数过滤方法 用于 ...
- SQL Server DML(SELECT)常见用法(二)
1 引言 上篇讲到SQL Server中DML的基本使用方法,其中SELECT语句是最常用的语句,其功能强大,结构复杂,下面通过例子,具体介绍其使用方法. 2 SELECT查询语句 SELECT语 ...
- java项目使用memcache实现session共享+session基础
本文章主要目的是配置session共享,为了巩固基础,捎带介绍了一些基础知识(网上搜索后觉得最全面的特引过来,节省时间),基础扎实的可以自动忽略. 基础篇: 1.了解java web中的session ...
- PHP上传图片至阿里云
<?php header("Content-type: text/html; charset=utf-8"); header('Access-Control-Allow-Or ...