SGU 404 Fortune-telling with camomile
404. Fortune-telling with camomile
Memory limit: 65536
kilobytes
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.
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 the resulting phrase.
sample input |
sample output |
6 4 |
doesnt |
sample input |
sample output |
9 3 |
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的更多相关文章
- 今日SGU 5.20
SGU 404 题意:.. 收获:取模 #include<bits/stdc++.h> #define de(x) cout<<#x<<"="& ...
- Petrozavodsk Summer Training Camp 2017 Day 9
Petrozavodsk Summer Training Camp 2017 Day 9 Problem A. Building 题目描述:给出一棵树,在树上取出一条简单路径,使得该路径的最长上升子序 ...
- Register-SPWorkflowService 404
最近需要做一个SharePoint 2013工作流演示环境. 于是在自己的本子上安装了一个虚拟机. 虚拟机操作系统是Windows Server 2012 R2,计划把AD.SQL Server 20 ...
- 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 ...
- 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 ...
- 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 ...
- thinkphp访问不存在的模块或者方法跳转到404页面
使用的thinkphp 版本是3.2.0, 在config.php中配置 404地址,即可: 'TMPL_EXCEPTION_FILE' => './Application/Home/View/ ...
- 网站设置404页面 --nginx
有的时候根据域名要先知道用的什么web 服务器 最简单的 http://tool.chinaz.com/pagestatus/ 输入域名,看返回的头部信息 用的那个web浏览器 下面的方法也是根据头 ...
- HTTP 错误 404.3 – Not Found 由于扩展配置问题而无法提供您请求的页面。如果该页面是脚本,请添加处理程序。如果应下载文件,请添加 MIME 映射。
今天,在vs2013中新建了一个placard.json文件,当我用jq读取它的时候,去提示404,直接在浏览器访问这个文件,提示: HTTP 错误 404.3 – Not Found 由于扩展配置问 ...
随机推荐
- python3之pymysql模块
1.python3 MySQL数据库链接模块 PyMySQL 是在 Python3.x 版本中用于连接 MySQL 服务器的一个库,Python2中则使用mysqldb. PyMySQL 遵循 Pyt ...
- 【网页开发学习】Coursera课程《面向 Web 开发者的 HTML、CSS 与 Javascript》Week1课堂笔记
Coursera课程<面向 Web 开发者的 HTML.CSS 与 Javascript> Johns Hopkins University Yaakov Chaikin Week1 In ...
- java基础74 XML解析中的SAX解析相关知识点(网页知识)
1.SAX解析工具 SAX解析工具:是Sun公司提供的,内置JDK中.org.xml.sax.* 点击查看: DOM解析相关知识:以及DOM和SAX解析的原理(区别) 2.SAX解析的 ...
- 20165333 2017-2018-2《Java程序设计》课程总结
一.每周作业链接汇总 1.预备作业一:我期望的师生关系 简要内容: 印象深刻的老师 我期望的师生关系 关于JAVA学习 2.预备作业二:学习基础和C语言学习基础 简要内容: 技能学习 C语言学习 关于 ...
- Struts DynaActionForm example
The Struts DynaActionForm class is an interesting feature to let you create a form bean dynamically ...
- 树莓派3B安装远程
步骤1:树莓派3安装 RDP SERVER 及VNC SERVER sudo apt-get install -y tightvncserver sudo vncserver 最后才知道一定要加上VN ...
- C#连接mariadb代码及方式
不负责任的说MariaDb和MySQL很多都是通用的,因为来自同一个爹... 和MySQL连接方式差不多 首先配置好你的MariaDb,创建test数据库,在test里创建MyTable表,脚本如下( ...
- Docker镜像和容器
本节内容: 安装Docker 卸载docker 镜像基本操作 容器基本操作 一.安装Docker Docker 对 Linux 内核版本的最低要求是3.10,如果内核版本低于 3.10 会缺少一些运行 ...
- spring-boot分环境打包为jar包
1.pom配置 <!-- 多环境打包 start --> <profiles> <!-- 开发环境配置 --> <profile> <id> ...
- HBase(六)HBase整合Hive,数据的备份与MR操作HBase
一.数据的备份与恢复 1. 备份 停止 HBase 服务后,使用 distcp 命令运行 MapReduce 任务进行备份,将数据备份到另一个地方,可以是同一个集群,也可以是专用的备份集群. 即,把数 ...