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