#include <iostream> using namespace std; int main() { ios::sync_with_stdio(0); int n; char tmp; string str(8, 0), answer; cin >> n; for(int i = 0; i < n; ++i) { for(char& s : str) cin >> s; tmp = (char)stoi(str, nullptr, 2); if(tmp < 'a' || tmp > 'z') { cout << "NIE\n"; return 0; } else { answer.push_back(tmp); } } cout << answer; 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 | #include <iostream> using namespace std; int main() { ios::sync_with_stdio(0); int n; char tmp; string str(8, 0), answer; cin >> n; for(int i = 0; i < n; ++i) { for(char& s : str) cin >> s; tmp = (char)stoi(str, nullptr, 2); if(tmp < 'a' || tmp > 'z') { cout << "NIE\n"; return 0; } else { answer.push_back(tmp); } } cout << answer; return 0; } |