#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <stdio.h> #include <iostream> #include <string.h> #include <math.h> #include <algorithm> #include <vector> int main() { int n; auto _ = scanf("%d\n", &n); std::string text; std::cin >> text; int groupSize = n / 10; int result = 0; for (int p = 0; p < n; p += groupSize) { const char* group = text.c_str() + p; bool shouldAddPoint = true; for (int i = 0; i < groupSize; i++) { if (*(group + i) == 'T') continue; shouldAddPoint = false; break; } if (shouldAddPoint) result++; } printf("%d\n", result); 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 24 25 26 27 28 29 30 31 32 33 34 35 36 | #define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <stdio.h> #include <iostream> #include <string.h> #include <math.h> #include <algorithm> #include <vector> int main() { int n; auto _ = scanf("%d\n", &n); std::string text; std::cin >> text; int groupSize = n / 10; int result = 0; for (int p = 0; p < n; p += groupSize) { const char* group = text.c_str() + p; bool shouldAddPoint = true; for (int i = 0; i < groupSize; i++) { if (*(group + i) == 'T') continue; shouldAddPoint = false; break; } if (shouldAddPoint) result++; } printf("%d\n", result); return 0; } |