cf A. Down the Hatch!

http://codeforces.com/contest/332/problem/A

 1 #include <cstdio>

 2 #include <iostream>

 3 #include <cstring>

 4 #include <algorithm>

 5 #define maxn 3000

 6 using namespace std;

 7 

 8 char str[maxn];

 9 

10 int main()

11 {

12     int n;

13     cin>>n;

14     cin>>str;

15     int k=strlen(str);

16     int cnt=0;

17     for(int i=n; i<k; i+=n)

18     {

19         if(str[i-1]==str[i-2]&&str[i-3]==str[i-2])

20             cnt++;

21     }

22     printf("%d\n",cnt);

23     return 0;

24 }
View Code

 

你可能感兴趣的:(HA)