#include <bits/stdc++.h>
using namespace std;
string s;
bool check(int x, int y)
{
for (int i=x; i<y; i++)
if (s[i] == 'N') return false;
return true;
}
int main()
{
int n, res = 0;
cin >> n >> s;
int r = n/10;
for (int i=0; i<=n-r; i+=r)
if (check(i, i+r) == true) res++;
cout << res;
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <bits/stdc++.h> using namespace std; string s; bool check(int x, int y) { for (int i=x; i<y; i++) if (s[i] == 'N') return false; return true; } int main() { int n, res = 0; cin >> n >> s; int r = n/10; for (int i=0; i<=n-r; i+=r) if (check(i, i+r) == true) res++; cout << res; return 0; } |
English