#include <iostream>
int main()
{
std::ios_base::sync_with_stdio(0);
std::cin.tie(0);
int size;
std::cin >> size;
int t_count = 0;
int m_count = 0;
std::string text = "";
bool check = true;
std::string t;
std::cin >> t;
int i = 0;
for (char chr : t) {
if (chr == '1') {
t_count++;
}
else {
m_count++;
}
if ((i + 1) % 8 == 0) {
if (t_count == 3 && m_count == 5) {
text += "a";
} else
if (t_count == 4 && m_count == 4) {
text += "e";
} else
if (t_count == 5 && m_count == 3) {
text += "k";
} else
if (t_count == 6 && m_count == 2) {
text += "o";
}
else {
check = false;
break;
}
t_count = 0;
m_count = 0;
}
i++;
}
if(check)
std::cout << text << std::endl;
else std::cout << "NIE" << std::endl;
}
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 53 54 55 56 | #include <iostream> int main() { std::ios_base::sync_with_stdio(0); std::cin.tie(0); int size; std::cin >> size; int t_count = 0; int m_count = 0; std::string text = ""; bool check = true; std::string t; std::cin >> t; int i = 0; for (char chr : t) { if (chr == '1') { t_count++; } else { m_count++; } if ((i + 1) % 8 == 0) { if (t_count == 3 && m_count == 5) { text += "a"; } else if (t_count == 4 && m_count == 4) { text += "e"; } else if (t_count == 5 && m_count == 3) { text += "k"; } else if (t_count == 6 && m_count == 2) { text += "o"; } else { check = false; break; } t_count = 0; m_count = 0; } i++; } if(check) std::cout << text << std::endl; else std::cout << "NIE" << std::endl; } |
English