#include <iostream> #include <cstdio> constexpr int MAX_N = 100; char s[MAX_N + 9]; int main() { int n, wyn = 0; scanf("%d", &n); scanf("%s", s); for (int i = 0; i < 10; ++i) { int d = 1; int m = (i + 1) * n / 10; for (int j = i * n / 10; j < m; ++j) { if (s[j] != 'T') { d = 0; break; } } wyn += d; } printf("%d\n", wyn); }
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 | #include <iostream> #include <cstdio> constexpr int MAX_N = 100; char s[MAX_N + 9]; int main() { int n, wyn = 0; scanf("%d", &n); scanf("%s", s); for (int i = 0; i < 10; ++i) { int d = 1; int m = (i + 1) * n / 10; for (int j = i * n / 10; j < m; ++j) { if (s[j] != 'T') { d = 0; break; } } wyn += d; } printf("%d\n", wyn); } |