ZeptoLab Code Rush 2015 A. King of Thieves

题目大意:

  就是说,对于一个起点,使得从这个起点开始,每次间隔相同的格子后,所经过的地方都是‘*’

解题思路:

  直接暴力,枚举起点+枚举公差

代码:

 1     # include<cstdio>
 2     # include<iostream>
 3 
 4     using namespace std;
 5 
 6     # define MAX 123
 7 
 8     char s[MAX];
 9     int a[MAX];
10 
11     int main(void)
12     {
13         int n;
14         scanf("%d",&n);
15         scanf("%s",s+1);
16         int flag = 0;
17         for ( int i = 1;i <= n;i++ )
18         {
19             for ( int j = 1;j <= 100;j++ )
20             {
21                 if ( s[i]=='*'&&s[i+j]=='*'&&s[i+2*j]=='*'&&s[i+3*j]=='*'&&s[i+4*j]=='*' )
22                 {
23                     flag = 1;
24                     break;
25                 }
26             }
27             if ( flag )
28                 break;
29         }
30         if ( flag )
31             cout<<"yes"<<endl;
32         else
33             cout<<"no"<<endl;
34 
35 
36 
37         return 0;
38     }

 

posted @ 2015-04-09 20:25  BYYB_0506  阅读(153)  评论(0编辑  收藏  举报