#include <iostream> #include <string> using namespace std; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); int count; cin >> count; int result = 0; int testsInGroup = count / 10; for(int group = 0; group < 10; group++) { bool passed = true; for(int test = 0; test < testsInGroup; test++) { char score; cin >> score; if(score!='T') { passed = false; } } if(passed) { result++; } } cout << result << "\n"; 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 | #include <iostream> #include <string> using namespace std; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); int count; cin >> count; int result = 0; int testsInGroup = count / 10; for(int group = 0; group < 10; group++) { bool passed = true; for(int test = 0; test < testsInGroup; test++) { char score; cin >> score; if(score!='T') { passed = false; } } if(passed) { result++; } } cout << result << "\n"; return 0; } |