20pts求助!!!
查看原帖
20pts求助!!!
259909
zhaluo楼主2020/11/11 20:11
#include<bits/stdc++.h>
using namespace std;

int main(){
	int n;
	cin>>n;
	if(n%2==1){
		cout<<-1;
		return 0;
	}
	int i=0,p[30];
	p[0]=1;
	while(p[i]*2<=n){
		p[++i]=p[i-1]*2;
	}
	n-=p[i];
	cout<<p[i]<<' ';
	while(n!=0){
		int j=0;
		for(;p[j+1]<=n;j++);
		n-=p[j];
		cout<<p[j]<<' ';
	}
	return 0;
}

虽然本蒟蒻的代码一看就会
但自己脚造的数据都能过,为啥会wa其他没t的点呢

2020/11/11 20:11
加载中...