#include <iostream>
using namespace std;
int main() {
int testNo;
cin >> testNo;
string testResults;
cin >> testResults;
int result = 0;
for (int i=0; i<10; i++) {
bool groupOk = true;
for(int j=0; j<(testNo/10); j++) {
groupOk &= (testResults.at(i*(testNo/10)+j) == 'T');
}
if(groupOk)
result++;
}
cout << result << endl;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <iostream> using namespace std; int main() { int testNo; cin >> testNo; string testResults; cin >> testResults; int result = 0; for (int i=0; i<10; i++) { bool groupOk = true; for(int j=0; j<(testNo/10); j++) { groupOk &= (testResults.at(i*(testNo/10)+j) == 'T'); } if(groupOk) result++; } cout << result << endl; } |
English