55分求救!!!急!!!
查看原帖
55分求救!!!急!!!
1339620
cx2013楼主2024/9/5 20:13
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,stk[50],top=0;
    cin>>n;
    if(n%2){
        cout<<-1;
    }else{
        while(n){
            stk[++top]=n%2;
            n/=2;
        }
        while(top){
            if(stk[top]){
                printf("%d",(int)pow(2,top-1));
            }
            top--;
        }
    }
    
    
    return 0;
    
    
    
}
2024/9/5 20:13
加载中...