31 lines
512 B
C++
31 lines
512 B
C++
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
|
|
int po(int x) {
|
|
int res = 1;
|
|
for (int i = 1; i <= x; i++)
|
|
res *= 2;
|
|
return res;
|
|
}
|
|
|
|
int main() {
|
|
int n;
|
|
cin >> n;
|
|
|
|
// 奇数直接输出-1
|
|
if (n % 2) {
|
|
cout << -1 << endl;
|
|
return 0;
|
|
}
|
|
|
|
vector<int> vec;
|
|
while (n) {
|
|
vec.push_back(n & 1);
|
|
n >>= 1;
|
|
}
|
|
|
|
for (int i = vec.size() - 1; i >= 0; i--)
|
|
if (vec[i]) cout << po(i) << " ";
|
|
|
|
return 0;
|
|
} |