#include <iostream> #include <string> using namespace std; int main(void){ int n, passed = 0; bool curPassed; string results; cin >> n; cin >> results; for(int j = 0; j < 10; j++){ curPassed = true; for(int i = 0; i < n/10; i++){ if(results[j*(n/10)+i] == 'N') curPassed = false; //cout << j*(n/10)+i << " " << results[j*(n/10)+i] << endl; } //cout << curPassed << " ======\n" ; if(curPassed) passed++; } cout << passed; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <iostream> #include <string> using namespace std; int main(void){ int n, passed = 0; bool curPassed; string results; cin >> n; cin >> results; for(int j = 0; j < 10; j++){ curPassed = true; for(int i = 0; i < n/10; i++){ if(results[j*(n/10)+i] == 'N') curPassed = false; //cout << j*(n/10)+i << " " << results[j*(n/10)+i] << endl; } //cout << curPassed << " ======\n" ; if(curPassed) passed++; } cout << passed; return 0; } |