#include <iostream> int main() { uint64_t len; std::cin >> len; std::string in; std::cin >> in; uint64_t group_size = len / 10; uint64_t score = 0; for (uint64_t i = 0; i < 10; ++i) { bool ok = true; for (uint64_t j = 0; j < group_size; ++j) { if (in[i * group_size + j] != 'T') { ok = false; } } if (ok) { score += 1; } } std::cout << score << "\n"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <iostream> int main() { uint64_t len; std::cin >> len; std::string in; std::cin >> in; uint64_t group_size = len / 10; uint64_t score = 0; for (uint64_t i = 0; i < 10; ++i) { bool ok = true; for (uint64_t j = 0; j < group_size; ++j) { if (in[i * group_size + j] != 'T') { ok = false; } } if (ok) { score += 1; } } std::cout << score << "\n"; } |