1 solutions

  • -2
    @ 2024-4-13 23:32:40

    #include #include using namespace std; queue q; int n; int main() { scanf("%d", &n); for(int i = 30; i >= 1; i--) { int now = (1 << i); if(now <= n) { n -= now; q.push(now); } } if(n != 0) printf("-1"); else while(!q.empty()) { printf("%d ", q.front()); q.pop(); } return 0; }

    • 1

    Information

    ID
    6224
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    # Submissions
    9
    Accepted
    5
    Uploaded By