bnu 45517

King of Thieves

Time Limit: 1000ms
Memory Limit: 262144KB
This problem will be judged on  CodeForces. Original ID:  526A
64-bit integer IO format:  %I64d      Java class name:  (Any)
Type: 
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •                   
  • 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 i1, he can make a sequence of jumps through the platforms i1 < i2 < ... < ik, if i2 - i1 = i3 - i2 = ... = ik - ik - 1. Of course, all segments i1, i2, ... ik 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 i1, i2, ..., i5, 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.

    Input 

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

    Output 

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

    Sample Input 

    Input
    16
    .**.*..*.***.**.
    Output
    yes
    Input
    11
    .*.*...*.*.
    Output
    no


    暴力无误    题意就是   是否存在5个*的下标能构成等差数列  

    #include <stdio.h>
    #include "stdio.h"
    
    int main()
    {
        int m;
        char ss[102];
        scanf("%d",&m);
        scanf("%s",ss+1);
        for(int i=1;i<=m;i++)
            for(int j=1;j<=m/4;j++)
                if(ss[i]=='*'&&ss[i+j]=='*'&&ss[i+j*2]=='*'&&ss[i+j*3]=='*'&&ss[i+j*4]=='*'){
                    printf("yes\n");
                    return 0;
                }
        printf("no\n");
        return 0;
    }

    评论
    添加红包

    请填写红包祝福语或标题

    红包个数最小为10个

    红包金额最低5元

    当前余额3.43前往充值 >
    需支付:10.00
    成就一亿技术人!
    领取后你会自动成为博主和红包主的粉丝 规则
    hope_wisdom
    发出的红包
    实付
    使用余额支付
    点击重新获取
    扫码支付
    钱包余额 0

    抵扣说明:

    1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
    2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

    余额充值