#include <bits/stdc++.h> using namespace std; typedef long long lld; int n; char s[1024]; int main() { scanf("%d%s", &n, s); n = n / 10; int sum = 0, res; for (int i = 0; i < 10; ++i) { res = 1; for (int j = i * n; j < (i + 1) * n; ++j) { if (s[j] == 'N') { res = 0; break; } } sum += res; } printf("%d\n", sum); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <bits/stdc++.h> using namespace std; typedef long long lld; int n; char s[1024]; int main() { scanf("%d%s", &n, s); n = n / 10; int sum = 0, res; for (int i = 0; i < 10; ++i) { res = 1; for (int j = i * n; j < (i + 1) * n; ++j) { if (s[j] == 'N') { res = 0; break; } } sum += res; } printf("%d\n", sum); return 0; } |