結果

問題 No.1298 OR XOR
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2023-05-14 23:12:30
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-30 09:12:36
合計ジャッジ時間 1,638 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

def bit(n: int):
    res = []
    while n != 0:
        res += [n % 2]
        n //= 2
    return res


n = int(input())
c = n
a, b = 0, 0
flg = False
for i, ci in enumerate(bit(c)):
    if ci != 0:
        if not flg:
            a = 2**i
            flg = True
        else:
            b += 2**i
if min(a, b, c) == 0:
    a, b, c = -1, -1, -1

print(a, b, c)
0