#include <cstdio> #include <iostream> #include <algorithm> #include <string> #include <unordered_set> #include <queue> using namespace std; int main(){ int n = 0; cin >> n; string testy; cin >> testy; int result = 0; //cout << testy << "\n"; for(int i = 0; i<10; ++i){ int pakiet = 0; for(int k = 0; k < n/10; ++k){ if(testy[(n/10)*i+k] == 'T'){ pakiet++; } } if(pakiet == n/10) { result++; } } cout << result << "\n"; 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 | #include <cstdio> #include <iostream> #include <algorithm> #include <string> #include <unordered_set> #include <queue> using namespace std; int main(){ int n = 0; cin >> n; string testy; cin >> testy; int result = 0; //cout << testy << "\n"; for(int i = 0; i<10; ++i){ int pakiet = 0; for(int k = 0; k < n/10; ++k){ if(testy[(n/10)*i+k] == 'T'){ pakiet++; } } if(pakiet == n/10) { result++; } } cout << result << "\n"; return 0; } |