#include <bits/stdc++.h> using namespace std; #define endl '\n' int main() { int n, count=0; char c; bool br=false; cin >> n; for (int i=0; i<10; ++i) { for (int j=0; j<(n/10); ++j) { cin >> c; if (!br && c == 'N') br=true; } if (br) br=false; else count++; } cout << count << endl; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <bits/stdc++.h> using namespace std; #define endl '\n' int main() { int n, count=0; char c; bool br=false; cin >> n; for (int i=0; i<10; ++i) { for (int j=0; j<(n/10); ++j) { cin >> c; if (!br && c == 'N') br=true; } if (br) br=false; else count++; } cout << count << endl; } |