結果

問題 No.1871 divisXor
ユーザー cologne
提出日時 2022-03-11 21:53:39
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 363 bytes
コンパイル時間 2,769 ms
コンパイル使用メモリ 248,252 KB
実行使用メモリ 6,940 KB
最終ジャッジ日時 2024-09-16 02:06:21
合計ジャッジ時間 5,363 ms
ジャッジサーバーID
(参考情報)
judge6 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
    long long N; cin >> N;
    vector<long long> ans;
    for(int K = 50; K>=0; --K)
    {
        if(N&(1LL<<K))
        {
            ans.push_back(1LL<<K);
            N ^= (1LL<<(K+1))-1;
        }
    }
    cout << ans.size() << endl;
    for(long long x: ans) cout << x << " ";
    cout << endl;
}
0