#include <iostream> using namespace std; int main() { int N; cin >> N; bool* Tests = new bool[N]; for (int t = 0; t < N; t++) { char c; cin >> c; Tests[t] = c == 'T'; } int Result = 0; for (int g = 0; g < 10; g++) { bool IsPoint = true; for (int t = 0; t < N / 10; t++) if (!Tests[g * N / 10 + t]) { IsPoint = false; break; } Result += IsPoint; } delete[] Tests; cout << 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 37 | #include <iostream> using namespace std; int main() { int N; cin >> N; bool* Tests = new bool[N]; for (int t = 0; t < N; t++) { char c; cin >> c; Tests[t] = c == 'T'; } int Result = 0; for (int g = 0; g < 10; g++) { bool IsPoint = true; for (int t = 0; t < N / 10; t++) if (!Tests[g * N / 10 + t]) { IsPoint = false; break; } Result += IsPoint; } delete[] Tests; cout << Result; return 0; } |