#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <ctime>
#include <cassert>
using namespace std;
#define assert_range(x,a,b) assert((a) <= (x) and (x) <= (b))
using ll = long long;
const int INF = 1e9;
int main() {
ios_base::sync_with_stdio(0);
int n, m;
cin >> n;
m = n/10;
string s;
cin >> s;
int res = 0;
for (int i = 0; i < 10; ++i) {
bool all_good = 1;
for (int j = 0; j < m; ++j) {
if (s[m*i+j] != 'T') {
all_good = false;
}
}
res += all_good;
}
cout << res << endl;
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 33 34 35 36 37 38 39 40 | #include <iostream> #include <cstdio> #include <string> #include <sstream> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <cmath> #include <algorithm> #include <cstring> #include <ctime> #include <cassert> using namespace std; #define assert_range(x,a,b) assert((a) <= (x) and (x) <= (b)) using ll = long long; const int INF = 1e9; int main() { ios_base::sync_with_stdio(0); int n, m; cin >> n; m = n/10; string s; cin >> s; int res = 0; for (int i = 0; i < 10; ++i) { bool all_good = 1; for (int j = 0; j < m; ++j) { if (s[m*i+j] != 'T') { all_good = false; } } res += all_good; } cout << res << endl; return 0; } |
English