#include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; string answers; cin>>answers; int result = 0; int groups_size = n/10; for(int i=0; i<10; i++){ bool error = 0; for(int j=0; j<groups_size; j++) if(answers[i*groups_size+j]=='N') error=1; if(!error) result++; } cout<<result; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; string answers; cin>>answers; int result = 0; int groups_size = n/10; for(int i=0; i<10; i++){ bool error = 0; for(int j=0; j<groups_size; j++) if(answers[i*groups_size+j]=='N') error=1; if(!error) result++; } cout<<result; return 0; } |