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