結果

問題 No.1298 OR XOR
ユーザー firiexp
提出日時 2020-11-27 21:26:20
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 656 bytes
コンパイル時間 2,545 ms
コンパイル使用メモリ 118,080 KB
最終ジャッジ日時 2025-01-16 06:24:56
ジャッジサーバーID
(参考情報)
judge3 / judge4
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n;
    cin >> n;
    if(__builtin_popcount(n) == 1) puts("-1 -1 -1");
    else {
        int a = -1, b = -1;
        for (int i = 0; i <= 30; ++i) {
            if(n & (1 << i)){
                if(a == -1) a = i;
                else b = i;
            }
        }
        printf("%d %d %d\n", n, (1 << a), n^(1 << a));
    }
    return 0;
}
0