#include <bits/stdc++.h> using namespace std; int main(){ int n, res = 0; char c; scanf("%d",&n); scanf("%c",&c); n /= 10; for (int i = 0; i < 10; ++i) { int tcounter = 0; for(int t = 0; t < n; ++t){ scanf("%c",&c); if(c == 'T') tcounter++; } if(tcounter == n) res++; } printf("%d",res); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <bits/stdc++.h> using namespace std; int main(){ int n, res = 0; char c; scanf("%d",&n); scanf("%c",&c); n /= 10; for (int i = 0; i < 10; ++i) { int tcounter = 0; for(int t = 0; t < n; ++t){ scanf("%c",&c); if(c == 'T') tcounter++; } if(tcounter == n) res++; } printf("%d",res); return 0; } |