蒟蒻第一次水讨论区。。。。。。。。
测试点17~20WA了。。。。。。
#include<bits/stdc++.h>
using namespace std;
long long n;
void dfs(int x){
if(x==0){
return;
}
for(int i=1;i<=25;i++){
if(pow(2,i)<=x&&pow(2,i+1)>x){
cout<<pow(2,i)<<" ";
dfs(x-pow(2,i));
return;
}
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
cin>>n;
if(n%2==1){
cout<<-1;
return 0;
}
dfs(n);
return 0;
}
回的关注!