#include <bits/stdc++.h> #define pb push_back #define ppb pop_back #define pf push_front #define ppf pop_back using namespace std; typedef int s32; typedef unsigned int u32; typedef long long s64; typedef unsigned long long u64; typedef pair <int, int> p32; typedef pair <s64, s64> p64; typedef vector <int> v32; typedef vector <s64> v64; s32 n, res, m; string s; void Init() { cin >> n >> s; m = n / 10; } void Solve() { for (s32 i = 0; i < (n + 1); i += m) { s32 j = i; for (j; j < (i + m); ++j) if (s[j] != 'T') break; if (j == i + m) ++res; } cout << res << '\n'; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); Init(); Solve(); 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 | #include <bits/stdc++.h> #define pb push_back #define ppb pop_back #define pf push_front #define ppf pop_back using namespace std; typedef int s32; typedef unsigned int u32; typedef long long s64; typedef unsigned long long u64; typedef pair <int, int> p32; typedef pair <s64, s64> p64; typedef vector <int> v32; typedef vector <s64> v64; s32 n, res, m; string s; void Init() { cin >> n >> s; m = n / 10; } void Solve() { for (s32 i = 0; i < (n + 1); i += m) { s32 j = i; for (j; j < (i + m); ++j) if (s[j] != 'T') break; if (j == i + m) ++res; } cout << res << '\n'; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); Init(); Solve(); return 0; } |