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年才是其真正进入主流市场的元年,最近国内大量 ...
随机推荐
- Android(digest)
Android开发者文档这么说的: Content providers manage access to a structured set of data. They encapsulate the ...
- paip.oracle10g dmp文件导入总结
paip.oracle10g dmp文件导入总结 作者Attilax , EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http://blog.csdn.net ...
- 最简单也最难——怎样获取到Android控件的高度
问题 怎样获取一个控件的长和高.相信非常多朋友第一眼看见这个问题都会认为非常easy,直接在onCreate里面调用getWidth.getMeasuredWidth不就能够获得了吗,可是.事实上是并 ...
- CSS Transform让百分比宽高布局元素水平垂直居中
很早以前了解过当元素是固定宽度和高度的时候,水平垂直高居中的方法可以设置margin的负值来使其居中,这个负值是元素的宽和高的一半,比如宽高是100px,那么就用margin-left:-50px;m ...
- C# Socket服务端和客户端互相send和receive
服务端 { ]; ; { ...
- ExecutorService 的理解与使用
ExecutorService 的理解与使用 http://my.oschina.net/bairrfhoinn/blog/177639 Java线程池ExecutorService http:// ...
- C语言静态函数静态变量
C语言程序可以看成由一系列外部对象构成,这些外部对象可能是变量或函数.而内部对象是指定义在函数内部的函数参数及变量. 外部变量定义在函数之外,因此可以在许多函数中使用.由于C语言不允许在一个函数中定义 ...
- struts2中的方法过滤拦截器
方法过滤拦截器是只过滤指定的方法,如果使用针对action 的普通的过滤器则会过滤该action内部 所有方法.如果在一个action中同时有多个作为业务逻辑控制的方法存在 的话则会过滤所有的业务逻辑 ...
- java 和 Python 的互调
http://www.cnblogs.com/lmyhao/p/3363385.html http://blog.csdn.net/wxiaow9000/article/details/5166029 ...
- Python爬虫:常用浏览器的useragent
1,为什么需要修改UserAgent 在写python网络爬虫程序的时候,经常需要修改UserAgent,有很多原因,罗列几个如下: 不同Agent下看到的内容不一样,比如,京东网站上的手机版网页和p ...