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 4
loves
doesnt
sincerely
doubts
doesnt
sample input
sample output
9 3
loves
doesnt
hates
hates
 #include<iostream>
#include<string.h>
#include<stdio.h>
#include<ctype.h>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include<vector>
#include<map>
#include<deque>
#include<list>
using namespace std;
char str[][];
int main()
{
int n,m;
while(scanf("%d%d",&n,&m)==){
for(int i=;i<=m;i++){
scanf("%s",str[i]);
}
int ans=n%m;
if(ans==) printf("%s\n",str[m]);
else printf("%s\n",str[ans]);
}
return ;
}

SGU 404 Fortune-telling with camomile的更多相关文章

  1. 今日SGU 5.20

    SGU 404 题意:.. 收获:取模 #include<bits/stdc++.h> #define de(x) cout<<#x<<"="& ...

  2. Petrozavodsk Summer Training Camp 2017 Day 9

    Petrozavodsk Summer Training Camp 2017 Day 9 Problem A. Building 题目描述:给出一棵树,在树上取出一条简单路径,使得该路径的最长上升子序 ...

  3. Register-SPWorkflowService 404

    最近需要做一个SharePoint 2013工作流演示环境. 于是在自己的本子上安装了一个虚拟机. 虚拟机操作系统是Windows Server 2012 R2,计划把AD.SQL Server 20 ...

  4. WinServer2008R2 + IIS 7.5 + .NET4.0 经典模式 运行WebAPI程序报404错误的解决方案

    在Windows Server 2008 R2系统下,IIS 7.5 + .NET Framework 4.0的运行环境,以经典模式(Classic Mode)部署一个用.NET 4.0编译的 Web ...

  5. sqoop:Failed to download file from http://hdp01:8080/resources//oracle-jdbc-driver.jar due to HTTP error: HTTP Error 404: Not Found

    环境:ambari2.3,centos7,sqoop1.4.6 问题描述:通过ambari安装了sqoop,又添加了oracle驱动配置,如下: 保存配置后,重启sqoop报错:http://hdp0 ...

  6. linux-关机出现Telling INIT to go to single user mode.无法关机

    运行/sbin/shutdown now最后显示:Telling INIT to go to single user mode.INIT:Going single userINIT:Sending g ...

  7. thinkphp访问不存在的模块或者方法跳转到404页面

    使用的thinkphp 版本是3.2.0, 在config.php中配置 404地址,即可: 'TMPL_EXCEPTION_FILE' => './Application/Home/View/ ...

  8. 网站设置404页面 --nginx

    有的时候根据域名要先知道用的什么web 服务器 最简单的 http://tool.chinaz.com/pagestatus/  输入域名,看返回的头部信息 用的那个web浏览器 下面的方法也是根据头 ...

  9. HTTP 错误 404.3 – Not Found 由于扩展配置问题而无法提供您请求的页面。如果该页面是脚本,请添加处理程序。如果应下载文件,请添加 MIME 映射。

    今天,在vs2013中新建了一个placard.json文件,当我用jq读取它的时候,去提示404,直接在浏览器访问这个文件,提示: HTTP 错误 404.3 – Not Found 由于扩展配置问 ...

随机推荐

  1. 金蝶K3物料选择问题(感觉Ctrl被按住了一样)

    金蝶K3在进入物料选择时,有时需要用Ctrl才可以进行多选,为什么有时不用Ctrl也可以进行多选,就像Ctrl被按住了一样? 解决:在物料选择界面按2次ctrl键单击物料可实现多选,再按2次ctrl则 ...

  2. C# 日文网址转punnycode

    Uri uri = new Uri(url); IdnMapping idn = new IdnMapping();url= url.Replace(uri.Host, idn.GetAscii(ur ...

  3. 03 Editor plugins and IDEs 编辑器插件和 ide

    Editor plugins and IDEs  编辑器插件和 ide Introduction  介绍 Options 选项   Introduction 介绍 This document list ...

  4. 如何从TFS(Visual Studio Team Foundation Server)映射下载本地文件夹

    1.连接tfs项目 首先打开vs2017 ——>工具栏 中的   团队——> 选择团队的管理链接 2.选择管理工作区 显示管理工作区的弹窗,点击 编辑  显示弹窗,选择本地文件夹(即要保存 ...

  5. (四)MyBatis关系映射

    第一节:一对一关系实现 需要实现一对一的关系,首先我们有两张表,t-addree和t_student. CREATE TABLE `t_address` ( `id` ) NOT NULL AUTO_ ...

  6. Java将字符串转成二进制码

    Java将字符串转成二进制码 public void toBinary(){ String str = "王雪"; char[] strChar=str.toCharArray() ...

  7. 《精通Python设计模式》学习结构型之外观模式

    这个我在工作中也有所应用的. 就是在真正的实现层上面,再封装一个函数的调用的. 这样就可以在内层函数作真正实现, 而外层调用函数对外开放, 隔离内外的变化性. from enum import Enu ...

  8. 美团外卖商家获取订单-signToken取值

    需要抓取美团历史订单,请联系QQ:858-048-581所需工具: findller chrome 获取外卖历史订单地址为: http://e.waimai.meituan.com/v2/order/ ...

  9. centos7.3 chrome 安装

    /etc/yum.repos.d/目录下新建文件google-chrome.repo,向其中添加如下内容: [google-chrome] name=google-chrome baseurl=htt ...

  10. require demo 记录备份

    预览地址 http://127.0.0.1:8020/requireDemo/myNEW/index.html 注意 远程的 非模块的 empty: demo2