CF526A.King of Thieves

普及-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

本题中,你将接触到游戏《盗贼之王》(King of Thieves)的一个简化模型。

在 ZeptoLab 公司新推出的名为《盗贼之王》的游戏中,你的目标是操控角色避开沿途的陷阱与障碍,最终抵达装有黄金的宝箱。

该游戏一个有趣的特性是:你可以自行设计关卡,并供其他玩家游玩。下面我们考虑一种如下所示的简单关卡设计。

地牢由位于同一水平高度上的 nn 个等长线段组成;每个线段要么是角色可站立的平台,要么是带有陷阱的深坑——若角色跌入其中,则游戏失败。在关卡示意图中,平台用字符 * 表示,深坑用字符 . 表示。

影响该关卡速通表现的因素之一,是能否执行一系列长度相等的连续跳跃。更准确地说:当角色位于编号为 i1i_1 的平台上时,他可以依次跳向平台 i1<i2<⋯<iki_1 < i_2 < \dots < i_k,当且仅当 i2−i1=i3−i2=⋯=ik−ik−1i_2 - i_1 = i_3 - i_2 = \dots = i_k - i_{k-1} 成立。当然,所有位置 i1,i2,…,iki_1, i_2, \dots, i_k 对应的线段都必须是平台,而不能是深坑。

我们称一个关卡是“良好”的,当且仅当存在一连串四次长度相等的跳跃;换言之,存在由五个平台构成的序列 i1,i2,…,i5i_1, i_2, \dots, i_5,使得相邻平台之间的间隔长度完全相等。现给定关卡的示意图,请判断该关卡是否为“良好”关卡。

输入格式

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 '.'.

第一行包含一个整数 nn(1≤n≤1001 \leq n \leq 100)—— 表示关卡中线段的数量。

下一行包含一个长度为 nn 的字符串,用以表示该关卡的布局,字符串中仅包含字符 * 和 .。

输出格式

If the level is good, print the word "yes" (without the quotes), otherwise print the word "no" (without the quotes).

如果关卡良好,则输出单词 “yes”(不带引号),否则输出单词 “no”(不带引号)。

输入输出样例

  • 输入#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.

在第一个样例测试中,你可以依次跳过平台 2、5、8、11、14。

输入解题思路,AI测评打分。不知道怎么写?

首页