全部评论 1

  • 没我好

    #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;
    })
    

    1周前 来自 福建

    0
暂无数据

提交答案之后,这里将显示提交结果~

首页