tj
2025-09-12 13:14:44
发布于:福建
0阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
long long n;
int main( ) {
cin >> n;
if (n % 2 == 1) {
cout << "-1" << endl;
return 0;
}
long long x = log2(n);
for (int i = x ; i >= 1 ; i--) {
if ((1 << i) <= n) {
cout << (1 << i) << " ";
n -= (1 << i);
}
}
return 0;
}
这里空空如也
有帮助,赞一个