- xuxiaofeng 的博客
优秀的拆分 (power)
- @ 2025-12-3 18:41:08
#include<bits/stdc++.h>
using namespace std;
int main(){
freopen("power.in","r",stdin);
freopen("power.out","w",stdout);
int n;
cin>>n;
if(n%2==1){
cout<<-1;
}
else{
for(int i=n;i>=1;i--){
if(n>=pow(2,i)){
cout<<fixed<<setprecision(0)<<pow(2,i)<<" ";
n-=pow(2,i);
}
}
}
return 0;
}