#include <iostream> // std::cout #include <algorithm> // std::sort #include <vector> // std::vector #include <set> #include <cmath> #include <string> #include <map> #include <cassert> #include <functional> #include <tuple> #include <numeric> #include <queue> #include <list> #include <cassert> using namespace std; int n, res; string c; int main() { scanf("%d\n", &n); getline(cin, c); for (int i = 0; i < n; i += n / 10) { bool failedTest = false; for (int j = i; j - i < n / 10; ++j) failedTest = (c[j] == 'N') ? true : failedTest; res += (failedTest) ? 0 : 1; } printf("%d", res); 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 | #include <iostream> // std::cout #include <algorithm> // std::sort #include <vector> // std::vector #include <set> #include <cmath> #include <string> #include <map> #include <cassert> #include <functional> #include <tuple> #include <numeric> #include <queue> #include <list> #include <cassert> using namespace std; int n, res; string c; int main() { scanf("%d\n", &n); getline(cin, c); for (int i = 0; i < n; i += n / 10) { bool failedTest = false; for (int j = i; j - i < n / 10; ++j) failedTest = (c[j] == 'N') ? true : failedTest; res += (failedTest) ? 0 : 1; } printf("%d", res); return 0; } |