#include <iostream> using namespace std; int main() { int points = 0; int count_one_group_tests; int tests_count; string tests_correct = ""; cin >> tests_count; cin >> tests_correct; count_one_group_tests = tests_count / 10; int counter = 0; for (int i = 0; i < tests_count; i++) { if (tests_correct[i] == 'N') { counter++; i = counter * count_one_group_tests - 1; } else if (i - counter * count_one_group_tests == count_one_group_tests - 1) { points++; counter++; } } cout << points; }
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 | #include <iostream> using namespace std; int main() { int points = 0; int count_one_group_tests; int tests_count; string tests_correct = ""; cin >> tests_count; cin >> tests_correct; count_one_group_tests = tests_count / 10; int counter = 0; for (int i = 0; i < tests_count; i++) { if (tests_correct[i] == 'N') { counter++; i = counter * count_one_group_tests - 1; } else if (i - counter * count_one_group_tests == count_one_group_tests - 1) { points++; counter++; } } cout << points; } |