#include <cstdio> int main(void) { size_t n; char s[100]; scanf("%zu\n%s", &n, s); size_t result = 0; for (size_t i = 0; i < 10; ++i) { bool good = true; for (size_t j = 0; j < n/10; ++j) { if (s[n*i/10+j] == 'N') { good = false; break; } } if (good) ++result; } printf("%zu\n", result); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include <cstdio> int main(void) { size_t n; char s[100]; scanf("%zu\n%s", &n, s); size_t result = 0; for (size_t i = 0; i < 10; ++i) { bool good = true; for (size_t j = 0; j < n/10; ++j) { if (s[n*i/10+j] == 'N') { good = false; break; } } if (good) ++result; } printf("%zu\n", result); } |