結果

問題 No.1298 OR XOR
ユーザー Rusty
提出日時 2023-01-17 16:21:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 504 bytes
コンパイル時間 232 ms
コンパイル使用メモリ 82,864 KB
実行使用メモリ 52,352 KB
最終ジャッジ日時 2025-01-02 16:15:17
合計ジャッジ時間 2,463 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
L = [int(s) for s in list(bin(n)[2:])]
a,b,c = 0,0,0
if sum(L) < 1:
    a,b,c = -1,-1,-1
    print(a,b,c)
else:
    t = 2
    for i in range(-1,-len(L)-1,-1):
        if L[i] > 0 and t == 2:
            t -= 1
            a += 1 << (-1-i)
            b += 1 << (-1-i)
        elif L[i] > 0 and t == 1:
            t -= 1
            a += 1 << (-1-i)
            c += 1 << (-1-i)
        elif L[i] > 0 and t == 0:
            a += 1 << (-1-i)
            b += 1 << (-1-i)
    print(a,b,c)
0