#include <iostream> #include <set> #include <map> #include <algorithm> using namespace std; int main() { ios_base::sync_with_stdio(false); unsigned n; string tests_string; cin >> n; cin >> tests_string; unsigned group_size = n / 10; unsigned score = 0; for (unsigned tg = 0; tg < tests_string.length(); tg += group_size) { bool all_passes = true; for (unsigned i = 0; i < group_size; i++) { if (tests_string[tg + i] == 'N') { all_passes = false; } } if (all_passes) { score += 1; } } cout << score << 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 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #include <iostream> #include <set> #include <map> #include <algorithm> using namespace std; int main() { ios_base::sync_with_stdio(false); unsigned n; string tests_string; cin >> n; cin >> tests_string; unsigned group_size = n / 10; unsigned score = 0; for (unsigned tg = 0; tg < tests_string.length(); tg += group_size) { bool all_passes = true; for (unsigned i = 0; i < group_size; i++) { if (tests_string[tg + i] == 'N') { all_passes = false; } } if (all_passes) { score += 1; } } cout << score << endl; return 0; } |