#include<bits/stdc++.h> using namespace std; #define nd second #define st first #define pb push_back typedef long long ll; typedef long double ld; void Solve() { int n, akt, w = 0; string s; cin >> n; cin >> s; for(int i = 1; i <= 10; ++i) { akt = 1; for(int j = 0; j < n / 10; ++j) if(s[(i - 1) * (n / 10) + j] == 'N') akt = 0; w += akt; } cout << w << "\n"; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); Solve(); 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 | #include<bits/stdc++.h> using namespace std; #define nd second #define st first #define pb push_back typedef long long ll; typedef long double ld; void Solve() { int n, akt, w = 0; string s; cin >> n; cin >> s; for(int i = 1; i <= 10; ++i) { akt = 1; for(int j = 0; j < n / 10; ++j) if(s[(i - 1) * (n / 10) + j] == 'N') akt = 0; w += akt; } cout << w << "\n"; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); Solve(); return 0; } |