#include <bits/stdc++.h> #define qio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define debug(x) cerr<<#x<<" "<<x<<endl #define ll long long #define st first #define nd second using namespace std; int n, res, temp; string s; int main() { qio; cin >> n >> s; for (int i = 1; i <= 10; i++) { temp = 0; for (int j = (n / 10) * (i - 1); j < (n / 10) * i; j++) { if (s[j] == 'T') temp++; } if (temp == n / 10) res++; } cout << res << endl; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <bits/stdc++.h> #define qio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define debug(x) cerr<<#x<<" "<<x<<endl #define ll long long #define st first #define nd second using namespace std; int n, res, temp; string s; int main() { qio; cin >> n >> s; for (int i = 1; i <= 10; i++) { temp = 0; for (int j = (n / 10) * (i - 1); j < (n / 10) * i; j++) { if (s[j] == 'T') temp++; } if (temp == n / 10) res++; } cout << res << endl; } |