#include <iostream> char C[200]; int count(char *c, int n) { for (int i=0;i<n;++i) if (c[i] == 'N') return 0; return 1; } int main() { std::ios_base::sync_with_stdio(0); int n; std::cin >> n; std::cin >> C; int sum = 0; for (int i=0;i<10;++i) { sum += count(C+i*(n/10), n/10); } std::cout << sum << std::endl; 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 <iostream> char C[200]; int count(char *c, int n) { for (int i=0;i<n;++i) if (c[i] == 'N') return 0; return 1; } int main() { std::ios_base::sync_with_stdio(0); int n; std::cin >> n; std::cin >> C; int sum = 0; for (int i=0;i<10;++i) { sum += count(C+i*(n/10), n/10); } std::cout << sum << std::endl; return 0; } |