#include <bits/stdc++.h> using namespace std; int main(){ int n; string s; cin>>n; cin>>s; int step = n/10; int i = 0; int wyn = 0; while (i < s.size()) { bool ok = true; for(int p = i; p < i + step; p++){ if(s[p] == 'N') ok = false; } i += step; if (ok) wyn++; } cout << wyn; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <bits/stdc++.h> using namespace std; int main(){ int n; string s; cin>>n; cin>>s; int step = n/10; int i = 0; int wyn = 0; while (i < s.size()) { bool ok = true; for(int p = i; p < i + step; p++){ if(s[p] == 'N') ok = false; } i += step; if (ok) wyn++; } cout << wyn; } |