#include <iostream> int main() { int test_count; std::cin >> test_count; std::string test_results; std::cin >> test_results; int test_size = test_count / 10; int all_points = 10; for (int i = 0; i < test_count; ++i) { if (test_results[i] == 'N') { i = (i / test_size * test_size) + test_size - 1; all_points--; } } std::cout << all_points; 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 | #include <iostream> int main() { int test_count; std::cin >> test_count; std::string test_results; std::cin >> test_results; int test_size = test_count / 10; int all_points = 10; for (int i = 0; i < test_count; ++i) { if (test_results[i] == 'N') { i = (i / test_size * test_size) + test_size - 1; all_points--; } } std::cout << all_points; return 0; } |