#include <cstdio> int main() { int N, p = 0; char str[1000]; scanf("%d%s", &N, str); int n = N/10; for (int i = 0, j = 0; i < 10; ++i) { bool all = true; for (int k = 0; k < n; ++k) { all &= str[j++] == 'T' ; } if (all) { ++p; } } printf("%d\n", p); 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> int main() { int N, p = 0; char str[1000]; scanf("%d%s", &N, str); int n = N/10; for (int i = 0, j = 0; i < 10; ++i) { bool all = true; for (int k = 0; k < n; ++k) { all &= str[j++] == 'T' ; } if (all) { ++p; } } printf("%d\n", p); return 0; } |