#include <iostream> using namespace std; int main() { int n; std::cin >> n; int cnt = 0; int res = 0; char c; for (int g = 0 ; g < 10 ; g++) { for (int j = 0 ; j < n / 10 ; j++) { std::cin >> c; if (c == 'T') cnt++; } if (cnt == n / 10) res++; cnt = 0; } std::cout << res; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <iostream> using namespace std; int main() { int n; std::cin >> n; int cnt = 0; int res = 0; char c; for (int g = 0 ; g < 10 ; g++) { for (int j = 0 ; j < n / 10 ; j++) { std::cin >> c; if (c == 'T') cnt++; } if (cnt == n / 10) res++; cnt = 0; } std::cout << res; } |