#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, w = 0;
cin >> n;
int p = n / 10;
string s;
cin >> s;
for(int i = 0; i < 10; i++)
{
int f = 1;
for(int j = i * p; j < (i + 1) * p; j++)
if(s[j] == 'N')
f = 0;
w += f;
}
cout << w;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <bits/stdc++.h> using namespace std; int main() { int n, w = 0; cin >> n; int p = n / 10; string s; cin >> s; for(int i = 0; i < 10; i++) { int f = 1; for(int j = i * p; j < (i + 1) * p; j++) if(s[j] == 'N') f = 0; w += f; } cout << w; } |
English