A9799 | King of Thieves
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
In this problem you will meet the simplified model of game King of Thieves.
In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character, avoiding traps and obstacles on your way.
An interesting feature of the game is that you can design your own levels that will be available to other players. Let's consider the following simple design of a level.
A dungeon consists of $n$ segments located at a same vertical level, each segment is either a platform that character can stand on, or a pit with a trap that makes player lose if he falls into it. All segments have the same length, platforms on the scheme of the level are represented as '\*' and pits are represented as '.'.
One of things that affects speedrun characteristics of the level is a possibility to perform a series of consecutive jumps of the same length. More formally, when the character is on the platform number $i_{1}$ , he can make a sequence of jumps through the platforms $i_{1}<i_{2}<...<i_{k}$ , if $i_{2}-i_{1}=i_{3}-i_{2}=...=i_{k}-i_{k-1}$ . Of course, all segments $i_{1},i_{2},...\ i_{k}$ should be exactly the platforms, not pits.
Let's call a level to be good if you can perform a sequence of four jumps of the same length or in the other words there must be a sequence $i_{1},i_{2},...,i_{5}$ , consisting of five platforms so that the intervals between consecutive platforms are of the same length. Given the scheme of the level, check if it is good.
In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character, avoiding traps and obstacles on your way.
An interesting feature of the game is that you can design your own levels that will be available to other players. Let's consider the following simple design of a level.
A dungeon consists of $n$ segments located at a same vertical level, each segment is either a platform that character can stand on, or a pit with a trap that makes player lose if he falls into it. All segments have the same length, platforms on the scheme of the level are represented as '\*' and pits are represented as '.'.
One of things that affects speedrun characteristics of the level is a possibility to perform a series of consecutive jumps of the same length. More formally, when the character is on the platform number $i_{1}$ , he can make a sequence of jumps through the platforms $i_{1}<i_{2}<...<i_{k}$ , if $i_{2}-i_{1}=i_{3}-i_{2}=...=i_{k}-i_{k-1}$ . Of course, all segments $i_{1},i_{2},...\ i_{k}$ should be exactly the platforms, not pits.
Let's call a level to be good if you can perform a sequence of four jumps of the same length or in the other words there must be a sequence $i_{1},i_{2},...,i_{5}$ , consisting of five platforms so that the intervals between consecutive platforms are of the same length. Given the scheme of the level, check if it is good.
输入格式
The first line contains integer $n$ ( $1<=n<=100$ ) — the number of segments on the level.
Next line contains the scheme of the level represented as a string of $n$ characters '\*' and '.'.
Next line contains the scheme of the level represented as a string of $n$ characters '\*' and '.'.
输出格式
If the level is good, print the word "yes" (without the quotes), otherwise print the word "no" (without the quotes).
输入输出样例
输入 #1
16 .**.*..*.***.**.
输出 #1
yes
输入 #2
11 .*.*...*.*.
输出 #2
no
In the first sample test you may perform a sequence of jumps through platforms $2,5,8,11,14$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted