8 solutions

  • 0
    @ 2026-8-14 20:03:45
    #include<bits/stdc++.h>
    using namespace std;
    int n;
    int main()
    {
    	cin>>n;
    	if(n%2!=0) cout<<"-1";
    	else{
    		bitset<32> a(n);
    		for(int i=31;i>=0;i--){
    			if(a[i]==1) cout<<(1<<i)<<" ";
    		}
    	}
    	return 0;
    }
    

    Information

    ID
    125
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    3
    Tags
    (None)
    # Submissions
    98
    Accepted
    38
    Uploaded By