题解
2025-06-16 16:15:50
发布于:广东
0阅读
0回复
0点赞
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int n,a[30],idx;
void change(int b){
int res=0;
while(b){
if (b&1) a[res]=pow(2,res);
res++;
b>>=1;
}
idx=res;
}
int main(){
scanf("%d",&n);
if (n%21 || n0){
printf("-1");
return 0;
}
change(n);
for(int i=idx;i>=1;i--)
if (a[i]!=0) printf("%d ",a[i]);
return 0;
}
这里空空如也
有帮助,赞一个