博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SGU 404 Fortune-telling with camomile
阅读量:7087 次
发布时间:2019-06-28

本文共 2038 字,大约阅读时间需要 6 分钟。

404. Fortune-telling with camomile

Time limit per test: 0.25 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard

Masha loves Petya. The following question gives her no rest: does Petya love her too? The best way to find this out is a fortune-telling. There are plenty ways of fortune predicting, but Masha prefers fortune-telling with camomile more than others. It's rules are simple. You should take camomile into the right hand and start picking petals one by one. After each petal you should pronounce one phrase from the predefined list. Such phrases like "loves", "doesn't love", "loves sincerely", "doubts", "wants to date", "laughs" are usually used. Phrases are pronounced from the first to the last. The list of phrases is cyclic, so after the last phrase you should pronounce the first one. The phrase that you pronounce after the last petal will be an answer.
Since Masha doesn't want to go to the forest and look for camomiles, she asks you to write the program which will simulate the process.

Input

First line of the input file contains two integer numbers N and M (1 ≤ N ≤ 100, 1 ≤ M ≤ 100), the number of petals and the number of phrases. Each of the following M lines contains one phrase. Phrases consist only of latin letters and their lengths are between 1 and 100.

Output

Output the resulting phrase.

Example(s)
sample input
sample output
6 4lovesdoesntsincerelydoubts
doesnt

 

sample input
sample output
9 3lovesdoesnthates
hates
1 #include
2 #include
3 #include
4 #include
5 #include
6 #include
7 #include
8 #include
9 #include
10 #include
11 #include
12 #include
13 #include
14 using namespace std;15 char str[110][110];16 int main()17 {18 int n,m;19 while(scanf("%d%d",&n,&m)==2){20 for(int i=1;i<=m;i++){21 scanf("%s",str[i]);22 }23 int ans=n%m;24 if(ans==0) printf("%s\n",str[m]);25 else printf("%s\n",str[ans]);26 }27 return 0;28 }
View Code

 

转载地址:http://iwgml.baihongyu.com/

你可能感兴趣的文章
AIX 5L学习总结3
查看>>
关于SAP,华为,BEA收购那点事儿
查看>>
黑客攻防专题五:IPC$空连接的入侵和防御
查看>>
SQL SERVER SQLOS的任务调度
查看>>
【javascript】异步编年史,从“纯回调”到Promise
查看>>
教学思路ASP.Net之服务器控件:三、DropDownList、ListBox、CheckBoxList、RadioButtonList控件...
查看>>
puppet之用户管理
查看>>
技术分享连载(三十五)
查看>>
Quartz.net官方开发指南 第八课:SchedulerListeners
查看>>
redhat/centos学习笔记
查看>>
linux系统日志
查看>>
Oracle 11.2.0.3管理ASM实例
查看>>
【物联网中间件平台-06】RFID刷卡拍照
查看>>
【游戏开发备注之三】GameCenter登陆出现“无法识别此游戏”问题的两种解决方法...
查看>>
轻松获取海量长尾词 网站流量提升不再难
查看>>
sysbench的安装和做性能测试
查看>>
一道简单而又容易出错的题目
查看>>
报告:NVMe存储系统机遇与挑战
查看>>
从趣味游戏到排序算法(4)
查看>>
组策略妙用----通过组策略禁止域用户更改IP地址
查看>>