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. NTC热敏电阻认识及功率型热敏电阻选型

    -------------------记公司一款已经量产的产品,在最新加工的批次上出现:刚上电就炸毁功率型热敏电阻的问题------------------------- ************写在 ...

  2. juery下拉刷新,ajax请求,div加载更多元素(一)

    ;//设置当前页数 var flag=true; //滑动加载 $(function(){ var winH = $(window).height(); //页面可视区域高度 $(window).sc ...

  3. bzoj 1034 泡泡堂BNB

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1034 题解: 很明显的贪心,读过田忌赛马的典故就很容易能想出来,分成三种情况讨论: < ...

  4. Redis相关链接

    Redis 教程 http://www.runoob.com/redis/redis-data-types.html Python操作redis学习系列之(集合)set,redis set详解 (六) ...

  5. IntelliJ IDEA + Maven + Tomcat 本地开发、部署、调试。

    1.maven 下载 解压 配置下 远程仓库( 用阿里云的 比较快).本地仓库 (可以本地C盘建立个文件夹当仓库).环境变量(方便使用maven命令)就可以了. 2.tomcat 下载 解压 配置下 ...

  6. poj 3270(置换群+贪心)

    Cow Sorting Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 6993   Accepted: 2754 Descr ...

  7. rocketmq在linux上安装

    1.下载bin压缩包,然后解压 官网下载地址:https://www.apache.org/dyn/closer.cgi?path=rocketmq/4.3.2/rocketmq-all-4.3.2- ...

  8. Web前端开发最佳实践(10):JavaScript代码不好读,不好维护?你需要改变写代码的习惯

    前言 这篇文章本应该在上一篇文章:使用更严格的JavaScript编码方式,提高代码质量之前发布,但当时觉得这篇文章太过基础,也就作罢.后来咨询了一些初级的开发者,他们觉得有必要把这篇文章也放上来.尽 ...

  9. 成功实施的APS项目故事分享---我们数据治理的心路历程

    一.故事背景 A企业是易普优APS重要客户之一,是某行业的龙头企业:APS项目历时7个月顺利上线,十个月验收!通过易普优APS的顺利实施,建成了集团的精益计划管控运营平台,树立计划的权威与指挥棒作用, ...

  10. Loadrunner参数化如何在记事本中将参数值显示超过100个参数值

    Loadrunner参数化如何在记事本中将参数值显示超过100个参数值 1.loadrunner的参数值没有最大的限度, 可以修改C:\Program Files\HP\LoadRunner\conf ...