#include <bits/stdc++.h> #define ll long long using namespace std; int main() { std::ios::sync_with_stdio(false); ll n, res = 0; cin >> n; string S; cin >> S; const ll rounds = 10; for(ll i = 0; i < rounds; i++) { bool all_good = true; for(ll j = 0; j < (n / rounds); j++) all_good &= S[i * (n / rounds) + j] == 'T'; if(all_good) res += 1; } cout << res << "\n"; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <bits/stdc++.h> #define ll long long using namespace std; int main() { std::ios::sync_with_stdio(false); ll n, res = 0; cin >> n; string S; cin >> S; const ll rounds = 10; for(ll i = 0; i < rounds; i++) { bool all_good = true; for(ll j = 0; j < (n / rounds); j++) all_good &= S[i * (n / rounds) + j] == 'T'; if(all_good) res += 1; } cout << res << "\n"; return 0; } |