#include <iostream> using namespace std; int main() { int n,wyn = 0,pop,pom; string s; bool cur; cin >> n; pop = n / 10; cin >> s; for (int i = 0; i < 10; i++) { pom = i * pop; cur = true; for (int j = pom; j < pom + pop; j++) { if (s[j] == 'N') cur = false; } wyn += cur; } cout << wyn; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <iostream> using namespace std; int main() { int n,wyn = 0,pop,pom; string s; bool cur; cin >> n; pop = n / 10; cin >> s; for (int i = 0; i < 10; i++) { pom = i * pop; cur = true; for (int j = pom; j < pom + pop; j++) { if (s[j] == 'N') cur = false; } wyn += cur; } cout << wyn; } |