#include <bits/stdc++.h> #define ll long long #define fors(u, n, s) for(ll u=(s); u < (n); u++) #define foru(u, n) fors(u, n, 0) #define ir(a, b, x) (((a) <= (x)) && ((x) <= (b))) using namespace std; int main() { int n; cin >> n; int ans = 0; bool x = true; foru(i, n){ char c; cin >> c; x=x&&(c=='T'); if((i+1)%(n/10)==0){ ans += x; x = true; } } cout << ans; 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 | #include <bits/stdc++.h> #define ll long long #define fors(u, n, s) for(ll u=(s); u < (n); u++) #define foru(u, n) fors(u, n, 0) #define ir(a, b, x) (((a) <= (x)) && ((x) <= (b))) using namespace std; int main() { int n; cin >> n; int ans = 0; bool x = true; foru(i, n){ char c; cin >> c; x=x&&(c=='T'); if((i+1)%(n/10)==0){ ans += x; x = true; } } cout << ans; return 0; } |