#include #include #include using namespace std; int main() { long a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0; int k; cin >> k; if (k==0) { cout << "うそーん" << endl; } while (k > 10000&&k%2==0) { k /= 2; h++; } for ( a = 2; a <= 30; a++) { b = a - 1; if (k * 2 / (a*b) == 1&& k * 2 % (a*b) == 0) { for (c = 0; c < a; c++) { cout << "1 "; } cout << endl; return 0; } } for ( a = 1; a <= 30; a++) { if (a>1) { b = a - 1; } else { b = 1; } if (k%(a*b)==0) { c = k / (a*b); if (!(c & (c - 1))) { d = 0; while (c != 1) { d++; c /= 2; } if (a == 1) { a++; d--; } if (d==1) { } cout << d + a + 1+h << endl; if (a == 2) { } for (b = 0; b <= d; b++) { cout << "0 "; } for ( b = 0; b < h; b++) { cout << "0 "; } for (b = 0; b < a; b++) { cout << "1 "; } cout << endl; return 0; } } } return 0; }