#include<bits/stdc++.h> using namespace std; int n; string s; bool flag = false; int result = 10; int main() { cin >> n >> s; for (int j = 0; j < n; j+=n/10) { for (int i = 0; i < n / 10; i++) { if (s[i + j] == 'N') { flag = true; } } if (flag) { result--; } flag = false; } cout << result; return 0; }
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 n; string s; bool flag = false; int result = 10; int main() { cin >> n >> s; for (int j = 0; j < n; j+=n/10) { for (int i = 0; i < n / 10; i++) { if (s[i + j] == 'N') { flag = true; } } if (flag) { result--; } flag = false; } cout << result; return 0; } |