#include <iostream> using namespace std; int main() { int n, pkt=0; ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; int x = n / 10; string testy; cin >> testy; for (int i = 0; i*x < n; i++) { int j = 0; bool check = true; while (j < x) { if (testy[i * x + j] == 'N') { check = false; break; } j++; } if (check) pkt++; } cout << pkt; }
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 | #include <iostream> using namespace std; int main() { int n, pkt=0; ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; int x = n / 10; string testy; cin >> testy; for (int i = 0; i*x < n; i++) { int j = 0; bool check = true; while (j < x) { if (testy[i * x + j] == 'N') { check = false; break; } j++; } if (check) pkt++; } cout << pkt; } |