#include <iostream> int main() { int size = 0; std::string s; std::cin >> size >> s; int blockSize = s.length() / 10; int score = 0; for (int i = 0; i < s.length(); i += blockSize) { bool valid = true; for (int j = i; j < i + blockSize; ++j) { if (s[j] == 'N') { valid = false; } } score += valid; } std::cout << score << 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 | #include <iostream> int main() { int size = 0; std::string s; std::cin >> size >> s; int blockSize = s.length() / 10; int score = 0; for (int i = 0; i < s.length(); i += blockSize) { bool valid = true; for (int j = i; j < i + blockSize; ++j) { if (s[j] == 'N') { valid = false; } } score += valid; } std::cout << score << std::endl; return 0; } |