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 由于扩展配置问 ...
随机推荐
- python内置模块之itertools
前言 itertools模块是python内置的迭代器模块,定义了可生成多种迭代器的函数,用来代替可迭代对象的遍历等操作,节约内存. 迭代器函数的类型 无限迭代器:包括count.cycle.repe ...
- 【内核】linux内核启动流程详细分析【转】
转自:http://www.cnblogs.com/lcw/p/3337937.html Linux内核启动流程 arch/arm/kernel/head-armv.S 该文件是内核最先执行的一个文件 ...
- Resouce, platform_device 和 platform_driver 的关系【转】
转自:http://blog.csdn.net/uruita/article/details/7278313 從2.6版本開始引入了platform這個概念,在開發底層驅動程序時,首先要確認的就是設備 ...
- SDN核心技术剖析和实战指南---读书笔记
第一章 SDN定义如下: SDN是一种新兴的基于软件的网络架构及技术,其最大的特点在于具有松耦合的控制平面与数据平面.支持集中化的网络状态控制.实现底层网络设施对上层应用的透明. SDN和NFV: O ...
- React-Native 之 FlexBox介绍和使用
# 前言 学习本系列内容需要具备一定 HTML 开发基础,没有基础的朋友可以先转至 HTML快速入门(一) 学习 本人接触 React Native 时间并不是特别长,所以对其中的内容和性质了解可能会 ...
- Focal Loss笔记
论文:<Focal Loss for Dense Object Detection> Focal Loss 是何恺明设计的为了解决one-stage目标检测在训练阶段前景类和背景类极度不均 ...
- 三、springcloud之服务调用Feign
一.背景 项目中接口调用: Httpclient Okhttp Httpurlconnection RestTemplate 微服务提供了更简单,方便的Feign 二.Feign简介 Feign是一个 ...
- Spark RDD 窄依赖研究
1.. 简介 spark从RDD依赖上来说分为窄依赖和宽依赖. 其中可以这样区分是哪种依赖:当父RDD的一个partition被子RDD的多个partitions引用到的时候则说明是宽依赖,否则为窄依 ...
- pip离线安装
pip freeze > requirements.txt pip download <packages> pip install --no-index --find-links=& ...
- J2V8 For Android
J2V8是基于Google的JavaScript引擎V8的Java开源项目,实现Java和JavaScript的相互调用.并对Android平台提供支持,最新版本提供了aar格式的类库包方便Andro ...