1 solutions

  • 0
    @ 2024-10-16 20:18:16
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    int n;
    cin>>n;
    if(n%2==1)
    {
    	cout<<-1;
    }
    else
    {
    	for(int i=30;i>=1;i--)
    	{
    		if(n>>i&1)
    		{
    			cout<<(1<<i)<<" ";
    		}
    	 } 
     } 
    return 0;
    }
    
    
    
    • 1

    Information

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