#include <iostream> using namespace std; int n, n10; int points = 0; bool correct = true; char results[100]; int main(){ cin >> n10; cin >> results; n = n10/10; for(int i=0; i<10; i++){ correct = true; for(int j=0; j<n; j++){ if(results[n*i + j] == 'N'){ correct = false; } } if(correct){ points++; } } cout << points << endl; }
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 | #include <iostream> using namespace std; int n, n10; int points = 0; bool correct = true; char results[100]; int main(){ cin >> n10; cin >> results; n = n10/10; for(int i=0; i<10; i++){ correct = true; for(int j=0; j<n; j++){ if(results[n*i + j] == 'N'){ correct = false; } } if(correct){ points++; } } cout << points << endl; } |