#include <iostream> #include <algorithm> using namespace std; string conversion(string num, int m, int n) { string ret=""; //栈 for (unsigned int i = 0; i < num.size(); ) { int k = 0; for (unsigned int j = i; j < num.size(); ++j) { int carry = (k * m + (num[j]-'0')) % n; num[j] = '0' + (k * m + (num[j]-'0')) / n; k = carry; } ret += char( k + '0'); while (num[i] == '0') i++; } reverse(begin(ret),end(ret)); return ret; } int main() { string num; while (cin >> num) { cout << conversion(num,10,2) << endl; } return 0; }