拖了好久的题解,想想还是补一下吧。

 

A. King of Thieves

直接枚举起点和5个点之间的间距,进行判断即可。

 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 
 4 char s[110];
 5 
 6 int main()
 7 {
 8     //freopen("in.txt", "r", stdin);
 9 
10     int n;
11     bool ans = false;
12     scanf("%d%s", &n, s);
13     for(int q = 0; q < n && !ans; q++) if(s[q] == '*')
14         for(int l = 1; q + 4*l < n; l++)
15         {
16             int i;
17             for(i = 1; i <= 4; i++) if(s[q + i*l] == '.') break;
18             if(i > 4) { ans = true; break; }
19         }
20 
21     printf("%s\n", ans ? "yes" : "no");
22 
23     return 0;
24 }
代码君

相关文章:

  • 2021-12-07
  • 2021-11-27
  • 2021-12-11
  • 2022-12-23
  • 2021-05-18
  • 2022-12-23
  • 2021-11-16
  • 2021-05-29
猜你喜欢
  • 2022-12-23
  • 2021-11-01
  • 2021-08-22
  • 2022-02-05
  • 2022-12-23
  • 2022-12-23
  • 2021-06-19
相关资源
相似解决方案