#include <bits/stdc++.h> using namespace std; int main() { int size; string tests; cin >> size; cin >> tests; int group_size = size / 10; int points = 0; for(int i = 0; i < size; i += group_size) { bool isGood = true; for(int k = i; k < i + group_size; k++) { if (tests[k] != 'T') { isGood = false; break; } } if(isGood) { points++; } } cout << points << 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 24 25 | #include <bits/stdc++.h> using namespace std; int main() { int size; string tests; cin >> size; cin >> tests; int group_size = size / 10; int points = 0; for(int i = 0; i < size; i += group_size) { bool isGood = true; for(int k = i; k < i + group_size; k++) { if (tests[k] != 'T') { isGood = false; break; } } if(isGood) { points++; } } cout << points << endl; return 0; } |