結果

問題 No.1298 OR XOR
ユーザー RustyRusty
提出日時 2023-01-17 16:21:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 504 bytes
コンパイル時間 402 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 71,740 KB
最終ジャッジ日時 2023-08-30 20:14:05
合計ジャッジ時間 3,376 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,656 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 70 ms
71,544 KB
testcase_07 AC 70 ms
71,472 KB
testcase_08 AC 70 ms
71,384 KB
testcase_09 AC 72 ms
71,536 KB
testcase_10 AC 71 ms
71,504 KB
testcase_11 AC 72 ms
71,388 KB
testcase_12 AC 71 ms
71,436 KB
testcase_13 AC 70 ms
71,284 KB
権限があれば一括ダウンロードができます

ソースコード

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