#include <bits/stdc++.h> //#define int long long #define ll long long #define db double #define fi first #define se second #define pii pair<int,int> #define vi vector<int> using namespace std; const int maxn=2e5; int n; char s[maxn+5]; int main() { scanf("%d",&n); scanf("%s",s+1); int len=n/10; int ans=0; for (int j=1;j<=10;j++) { int l=(j-1)*len+1,r=j*len; int ok=1; for (int k=l;k<=r;k++) { if (s[k]!='T') { ok=0; break ; } } ans+=ok; } cout<<ans<<'\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 <bits/stdc++.h> //#define int long long #define ll long long #define db double #define fi first #define se second #define pii pair<int,int> #define vi vector<int> using namespace std; const int maxn=2e5; int n; char s[maxn+5]; int main() { scanf("%d",&n); scanf("%s",s+1); int len=n/10; int ans=0; for (int j=1;j<=10;j++) { int l=(j-1)*len+1,r=j*len; int ok=1; for (int k=l;k<=r;k++) { if (s[k]!='T') { ok=0; break ; } } ans+=ok; } cout<<ans<<'\n'; return 0; } |