#include <cstdio> using namespace std; const int N = 100 + 9; char buf[N]; int groupScore[10]; int main() { int n; scanf("%d%s", &n, buf); int groupSize = n / 10; for (int i=0; i<10; ++i) groupScore[i] = 0; for (int i=0; i<n; ++i) if (buf[i] == 'T') groupScore[i/groupSize]++; int score = 0; for (int i=0; i<10; ++i) if (groupScore[i] == groupSize) ++score; printf("%d\n", score); 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 <cstdio> using namespace std; const int N = 100 + 9; char buf[N]; int groupScore[10]; int main() { int n; scanf("%d%s", &n, buf); int groupSize = n / 10; for (int i=0; i<10; ++i) groupScore[i] = 0; for (int i=0; i<n; ++i) if (buf[i] == 'T') groupScore[i/groupSize]++; int score = 0; for (int i=0; i<10; ++i) if (groupScore[i] == groupSize) ++score; printf("%d\n", score); return 0; } |