#include <cstdio> int main() { int n; scanf("%d", &n); char rate[n]; scanf("%s", rate); int score = 0; for (int i = 1; i < n + 1; ++i) { if (rate[i - 1] == 78) { i = (((i - 1) / (n / 10)) + 1) * (n / 10); } else if (rate[i - 1] == 84 && i % (n / 10) == 0) { score++; } } printf("%d", 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 23 | #include <cstdio> int main() { int n; scanf("%d", &n); char rate[n]; scanf("%s", rate); int score = 0; for (int i = 1; i < n + 1; ++i) { if (rate[i - 1] == 78) { i = (((i - 1) / (n / 10)) + 1) * (n / 10); } else if (rate[i - 1] == 84 && i % (n / 10) == 0) { score++; } } printf("%d", score); return 0; } |