#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; string s; cin >> s; int group_size = n / 10; int points = 0; for (int group = 0; group < 10; group++) { bool ok = true; for (int i = 0; i < group_size; i++) { ok &= s.back() == 'T'; s.pop_back(); } points += ok; } cout << points << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); // #ifdef LOCAL // geti(t); while (t--) // #endif solve(); cout.flush(); }
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 | #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; string s; cin >> s; int group_size = n / 10; int points = 0; for (int group = 0; group < 10; group++) { bool ok = true; for (int i = 0; i < group_size; i++) { ok &= s.back() == 'T'; s.pop_back(); } points += ok; } cout << points << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); // #ifdef LOCAL // geti(t); while (t--) // #endif solve(); cout.flush(); } |