#include <iostream> #include <stack> using namespace std; int main() { stack<int> s; int n; while(cin >> n) { while(n) { s.push(n % 2); n /= 2; } while(!s.empty()) { cout << s.top(); s.pop(); } cout << endl; } return 0; }
2024-03-17 13:46:46
#include <iostream> #include <stack> using namespace std; int main() { stack<int> s; int n; while(cin >> n) { while(n) { s.push(n % 2); n /= 2; } while(!s.empty()) { cout << s.top(); s.pop(); } cout << endl; } return 0; }