#include <iostream> using namespace std; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); int n; cin >> n; string s; cin >> s; int group_size=n/10, group_count = 10, score = 0; for(int g=0; g<group_count; ++g) { bool passed = true; for(int t=0; t<group_size; ++t) { if(s[g*group_size+t]=='N') { passed = false; break; } } if(passed) { score++; } } cout << score; 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 25 26 27 28 29 30 31 32 33 34 | #include <iostream> using namespace std; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); int n; cin >> n; string s; cin >> s; int group_size=n/10, group_count = 10, score = 0; for(int g=0; g<group_count; ++g) { bool passed = true; for(int t=0; t<group_size; ++t) { if(s[g*group_size+t]=='N') { passed = false; break; } } if(passed) { score++; } } cout << score; return 0; } |