#include <iostream> #include <unordered_set> #include <queue> #include <cassert> #include <algorithm> #include <vector> #include <set> #include <map> #include <numeric> #include <assert.h> #include <tuple> using namespace std; using ull = unsigned long long; using ll = long long; #ifdef GGDEBUG #define dbg printf #else #define dbg //dbg #endif int main() { int N; cin >> N; std::string s; cin >> s; int groups = 10; int tests_in_group = N / 10; dbg("%d %d\n", groups, tests_in_group); int test_now = 0; int result = 0; for (int t = 0; t < groups; ++t) { bool all_ok = true; for (int i = 0; i < tests_in_group; ++i) { dbg("NOW: %c\n", s[t * tests_in_group]); if (s[t * tests_in_group + i] != 'T') { all_ok = false; break; } } if (all_ok) { dbg("+1\n"); result++; } else { dbg("0\n"); } } printf("%d\n", result); 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #include <iostream> #include <unordered_set> #include <queue> #include <cassert> #include <algorithm> #include <vector> #include <set> #include <map> #include <numeric> #include <assert.h> #include <tuple> using namespace std; using ull = unsigned long long; using ll = long long; #ifdef GGDEBUG #define dbg printf #else #define dbg //dbg #endif int main() { int N; cin >> N; std::string s; cin >> s; int groups = 10; int tests_in_group = N / 10; dbg("%d %d\n", groups, tests_in_group); int test_now = 0; int result = 0; for (int t = 0; t < groups; ++t) { bool all_ok = true; for (int i = 0; i < tests_in_group; ++i) { dbg("NOW: %c\n", s[t * tests_in_group]); if (s[t * tests_in_group + i] != 'T') { all_ok = false; break; } } if (all_ok) { dbg("+1\n"); result++; } else { dbg("0\n"); } } printf("%d\n", result); return 0; } |