#include <algorithm> #include <cassert> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <ranges> #include <set> #include <string> #include <vector> using namespace std; int solve() { int n; string s; cin >> n >> s; int res = 0; int d = n / 10; for (int i = 0; i < 10; i++) { bool ok = true; for (int j = 0; j < d; j++) { ok &= s[i * d + j] == 'T'; } res += ok; } return res; } int main() { ios::sync_with_stdio(false); cin.exceptions(cin.failbit); cin.tie(0); cout << solve() << "\n"; }
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 | #include <algorithm> #include <cassert> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <ranges> #include <set> #include <string> #include <vector> using namespace std; int solve() { int n; string s; cin >> n >> s; int res = 0; int d = n / 10; for (int i = 0; i < 10; i++) { bool ok = true; for (int j = 0; j < d; j++) { ok &= s[i * d + j] == 'T'; } res += ok; } return res; } int main() { ios::sync_with_stdio(false); cin.exceptions(cin.failbit); cin.tie(0); cout << solve() << "\n"; } |