#include<vector>
#include <iostream>
#include<algorithm>
#include<queue>
#include<fstream>
using namespace std;
typedef long long ll;
#define f first
#define s second
int main()
{ ios_base::sync_with_stdio(); cin.tie();
int n; cin>>n;
int wynik=0;
string s;
cin>>s;
int licz=0;
for(int i=1;i<=10;i++)
{ int akt=0;
while(licz<(n/10)*i){if(s[licz]=='T')akt++;licz++;}
if(akt==n/10)wynik++;
}
cout<<wynik;
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 | #include<vector> #include <iostream> #include<algorithm> #include<queue> #include<fstream> using namespace std; typedef long long ll; #define f first #define s second int main() { ios_base::sync_with_stdio(); cin.tie(); int n; cin>>n; int wynik=0; string s; cin>>s; int licz=0; for(int i=1;i<=10;i++) { int akt=0; while(licz<(n/10)*i){if(s[licz]=='T')akt++;licz++;} if(akt==n/10)wynik++; } cout<<wynik; return 0; } |
English