#include <iostream>
int score_group(char* tests, int len) {
for (int i = 0; i < len; i++) {
if (tests[i] == 'N')
return 0;
}
return 1;
}
void solution(std::istream &instream, std::ostream &outstream) {
int n;
char* tests = new char[200];
instream >> n;
instream >> tests;
int result = 0;
for (int start = 0; start < n; start += n / 10) {
result += score_group(tests + start, n / 10);
}
outstream << result;
}
int main() {
solution(std::cin, std::cout);
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 <iostream> int score_group(char* tests, int len) { for (int i = 0; i < len; i++) { if (tests[i] == 'N') return 0; } return 1; } void solution(std::istream &instream, std::ostream &outstream) { int n; char* tests = new char[200]; instream >> n; instream >> tests; int result = 0; for (int start = 0; start < n; start += n / 10) { result += score_group(tests + start, n / 10); } outstream << result; } int main() { solution(std::cin, std::cout); return 0; } |
English