#include <string>
#include <iostream>
using namespace std;
string tests;
long sec = 0;
int n;
int main()
{
cin >> n;
cin >> tests;
int gr = n / 10, pkt = 0;
for (int i = 0; i < 10; i++)
{
bool t = true;
int j = 0;
while ((t == true) && (j < gr))
{
if (tests[i * gr + j++] != 'T')
t = false;
}
if (t == true)
pkt++;
}
cout << pkt;
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 | #include <string> #include <iostream> using namespace std; string tests; long sec = 0; int n; int main() { cin >> n; cin >> tests; int gr = n / 10, pkt = 0; for (int i = 0; i < 10; i++) { bool t = true; int j = 0; while ((t == true) && (j < gr)) { if (tests[i * gr + j++] != 'T') t = false; } if (t == true) pkt++; } cout << pkt; return 0; } |
English