#include <iostream> #include <string> using namespace std; int testCount = 0; string napis; int punkty = 0; int tempPkt = 0; int main() { cin >> testCount; cin >> napis; for (int i = 0; i < napis.length(); i += (testCount / 10)) { tempPkt = 0; for (int j = 0; j < (testCount / 10); j++) { if (napis[i + j] == 'T') tempPkt++; } if (tempPkt == (testCount / 10)) punkty++; } cout << punkty; 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 | #include <iostream> #include <string> using namespace std; int testCount = 0; string napis; int punkty = 0; int tempPkt = 0; int main() { cin >> testCount; cin >> napis; for (int i = 0; i < napis.length(); i += (testCount / 10)) { tempPkt = 0; for (int j = 0; j < (testCount / 10); j++) { if (napis[i + j] == 'T') tempPkt++; } if (tempPkt == (testCount / 10)) punkty++; } cout << punkty; return 0; } |