Fortune-telling with camomile
来源:互联网 发布:java与或非逻辑符号 编辑:程序博客网 时间:2024/05/16 12:40
Fortune-telling with camomile
Time limit per test: 0.5 second(s)
Memory limit: 65536 kilobytes
Memory limit: 65536 kilobytes
input: standard
output: 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 numbersN and M (1 ≤ N ≤ 100, 1 ≤ M ≤ 100), the number of petals and the number of phrases. Each of the followingM 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
#include<cstdio>#include<cstring>using namespace std;int main(){ int n,m; char t[105],res[105]; while(scanf("%d%d",&n,&m)!=EOF) { int k=n%m; if(k==0) k=m; // printf("%d\n",k); for(int i=1;i<=m;i++) { if(i==k) scanf("%s",res); else scanf("%s",t); } printf("%s\n",res); } return 0;}
- Fortune-telling with camomile
- SGU - 404 - Fortune-telling with camomile
- codeforces_59B Fortune Telling
- Fortune Telling 数花瓣--算命
- Codeforces59 B - Fortune Telling(再水)
- CodeForces 59 B.Fortune Telling(水~)
- I will be telling this with a sigh
- fortune client
- Today's fortune cookie
- Fortune China - 《财富》中文版
- Fortune's wheel
- fortune random server demo
- Linux Terminal fortune
- CodeForces 59BFortune Telling
- FORTUNE ARTERIAL 玩后感(无剧透)
- Qt-Fortune Client Example-翻译
- Voronoi Diagram and Fortune Algorithm
- I'm Telling the Truth
- exit(),_exit()与return的比较与浅析
- Java 中正确使用 hashCode 和 equals 方法
- libcurl - curl_easy_setopt()(未完,待续)
- 设置时间格式的JSpinner
- 黑马程序员之C#学习笔记:C#索引器与属性的区别、索引器的具体使用
- Fortune-telling with camomile
- 输入身份证自动生成出生日期(2)
- VS2008 V2010 平台迁移中:error C2440: "static_cast"
- 小练1
- 堆栈的详解
- 电话情结
- jsp作业(1)--使用jsp+servlet完成一个表单验证
- aidl项目笔记-入门
- main3-4.c 检验bo3-2.c的主程序