#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; bool isOK = true; int res = 0; for (int i = 1; i <= n; i++) { char c; cin >> c; if (c != 'T') isOK = false; if (i % (n / 10) == 0) { res += isOK; isOK = true; } } cout << res; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; bool isOK = true; int res = 0; for (int i = 1; i <= n; i++) { char c; cin >> c; if (c != 'T') isOK = false; if (i % (n / 10) == 0) { res += isOK; isOK = true; } } cout << res; } |