#include <algorithm>
#include <cstdint>
#include <ios>
#include <iostream>
#include <iterator>
#include <string>
#include <vector>
template <typename T> void print_value(const T &v);
template <typename T> void debug(const T &v, const std::string &s) {
std::cerr << s << ": '";
print_value(v);
std::cerr << "'\n";
}
template <> void print_value(const std::vector<int32_t> &v) {
for (const auto x : v) {
std::cerr << x << " ";
}
}
template <typename T> void print_value(const T& v) { std::cerr << v; }
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
std::string responses;
int n;
std::cin >> n;
std::cin.ignore();
const int tenth = n / 10;
int result = 0;
std::getline(std::cin, responses);
if (responses.length() != n) {
std::cerr << "Bad length!\n";
return 1;
}
for (int i = 0; i < 10; ++i) {
int batch_ok = true;
for (int j = 0; j < tenth; ++j) {
if (responses[tenth * i + j] == 'N')
batch_ok = false;
}
if (batch_ok) {
result++;
}
}
std::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 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #include <algorithm> #include <cstdint> #include <ios> #include <iostream> #include <iterator> #include <string> #include <vector> template <typename T> void print_value(const T &v); template <typename T> void debug(const T &v, const std::string &s) { std::cerr << s << ": '"; print_value(v); std::cerr << "'\n"; } template <> void print_value(const std::vector<int32_t> &v) { for (const auto x : v) { std::cerr << x << " "; } } template <typename T> void print_value(const T& v) { std::cerr << v; } int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); std::string responses; int n; std::cin >> n; std::cin.ignore(); const int tenth = n / 10; int result = 0; std::getline(std::cin, responses); if (responses.length() != n) { std::cerr << "Bad length!\n"; return 1; } for (int i = 0; i < 10; ++i) { int batch_ok = true; for (int j = 0; j < tenth; ++j) { if (responses[tenth * i + j] == 'N') batch_ok = false; } if (batch_ok) { result++; } } std::cout << result; return 0; } |
English