1 条题解

  • 0
    @ 2024-8-22 14:38:34

    #include<bits/stdc++.h> using namespace std; int main() { long long x, y, k; cin >> x; if (x % 2 == 1) { cout << "-1"; return 0; } y = 1; k = 2; while (x != 0) { if (k * 2 <= x) k *= 2; if (k * 2 > x) { x -= k; cout << k << " "; k = 2; } y++; } return 0; }

    信息

    ID
    7
    时间
    1000ms
    内存
    256MiB
    难度
    8
    标签
    递交数
    77
    已通过
    13
    上传者