/* * pun.ccp * * Created on: Dec 13, 2022 * Author: A.Mulawa */ #include <iostream> #include <string> int main(int argc, char **argv) { int n; std::cin >> n; int group = n / 10; std::string tests; std::cin >> tests; int res = 0; for (int i = 0; i < 10; i++) { int pass = 0; for (int j = 0; j < group; j++) { if (tests[i * group + j] == 'T') { pass++; } } if (pass == group) { res++; } } std::cout << res; }
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 | /* * pun.ccp * * Created on: Dec 13, 2022 * Author: A.Mulawa */ #include <iostream> #include <string> int main(int argc, char **argv) { int n; std::cin >> n; int group = n / 10; std::string tests; std::cin >> tests; int res = 0; for (int i = 0; i < 10; i++) { int pass = 0; for (int j = 0; j < group; j++) { if (tests[i * group + j] == 'T') { pass++; } } if (pass == group) { res++; } } std::cout << res; } |