結果
問題 | No.1298 OR XOR |
ユーザー |
![]() |
提出日時 | 2023-01-17 16:22:50 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 40 ms / 2,000 ms |
コード長 | 504 bytes |
コンパイル時間 | 365 ms |
コンパイル使用メモリ | 82,788 KB |
実行使用メモリ | 53,444 KB |
最終ジャッジ日時 | 2025-01-02 16:18:29 |
合計ジャッジ時間 | 1,916 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 13 |
ソースコード
n = int(input())L = [int(s) for s in list(bin(n)[2:])]a,b,c = 0,0,0if sum(L) < 2:a,b,c = -1,-1,-1print(a,b,c)else:t = 2for i in range(-1,-len(L)-1,-1):if L[i] > 0 and t == 2:t -= 1a += 1 << (-1-i)b += 1 << (-1-i)elif L[i] > 0 and t == 1:t -= 1a += 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)