#include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; string t; cin >> t; int res = 0; for(int k=0;k<10;k++) { bool able = true; for(int i=k*(n/10);i<(k+1)*(n/10);i++) { if(t[i] == 'N') able = false; } if(able) res++; } cout << res <<endl; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; string t; cin >> t; int res = 0; for(int k=0;k<10;k++) { bool able = true; for(int i=k*(n/10);i<(k+1)*(n/10);i++) { if(t[i] == 'N') able = false; } if(able) res++; } cout << res <<endl; } |