結果

問題 No.1871 divisXor
ユーザー srjywrdnprkt
提出日時 2023-05-21 06:05:45
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 609 bytes
コンパイル時間 776 ms
コンパイル使用メモリ 106,776 KB
最終ジャッジ日時 2025-02-13 03:56:18
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;
using ll = long long;

int main(){

    ll N;
    cin >> N;
    vector<ll> ans; 

    if (N == 0){
        cout << -1 << endl;
        return 0;
    }

    for (int i=40; i>=0; i--){
        if ((N >> i) % 2 != ans.size() % 2) ans.push_back((1LL<<i));
    }
    
    cout << ans.size() << endl;
    for (auto x : ans) cout << x << " ";
    cout << endl;

    return 0;
}
0