#include <bits/stdc++.h> using namespace std; int main() { std::ios_base::sync_with_stdio(false); int N; string input; cin >> N; cin >> input; int tests_per_group = N/10; int counter = 0; for(int i = 0; i < N/tests_per_group; i++){ counter++; for(int j = 0; j < tests_per_group; j++) { if(input[i*tests_per_group+j] == 'N'){ counter--; break; } } } cout<<counter<<endl; 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 | #include <bits/stdc++.h> using namespace std; int main() { std::ios_base::sync_with_stdio(false); int N; string input; cin >> N; cin >> input; int tests_per_group = N/10; int counter = 0; for(int i = 0; i < N/tests_per_group; i++){ counter++; for(int j = 0; j < tests_per_group; j++) { if(input[i*tests_per_group+j] == 'N'){ counter--; break; } } } cout<<counter<<endl; return 0; } |