#include <bits/stdc++.h> using namespace std; int main() { std::ios::sync_with_stdio(false); int N, ret = 0; cin >> N; string in; cin >> in; vector<bool> groups(10, true); int numOfTestInGroup = in.size() / 10; for (size_t i = 0; i < in.size(); ++i) { groups[i / numOfTestInGroup] = groups[i / numOfTestInGroup] && in[i] == 'T'; } for (auto a : groups) ret += a ? 1 : 0; cout << ret << endl; 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 | #include <bits/stdc++.h> using namespace std; int main() { std::ios::sync_with_stdio(false); int N, ret = 0; cin >> N; string in; cin >> in; vector<bool> groups(10, true); int numOfTestInGroup = in.size() / 10; for (size_t i = 0; i < in.size(); ++i) { groups[i / numOfTestInGroup] = groups[i / numOfTestInGroup] && in[i] == 'T'; } for (auto a : groups) ret += a ? 1 : 0; cout << ret << endl; return 0; } |