結果
| 問題 |
No.1298 OR XOR
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-23 22:40:17 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 40 ms / 2,000 ms |
| コード長 | 589 bytes |
| コンパイル時間 | 217 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 52,096 KB |
| 最終ジャッジ日時 | 2024-11-26 02:48:56 |
| 合計ジャッジ時間 | 1,403 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
ソースコード
N = int(input())
bit = list(bin(N)[2:])
A,B,C = '','',''
count = 0
if bit.count('1') == 1:
A += '0'
B += '1'
C += '1'
for b in bit:
if b == '1':
if count%2 == 0:
A += '1'
B += '1'
C += '0'
else:
A += '0'
B += '1'
C += '1'
count += 1
else:
A += '0'
B += '0'
C += '0'
A,B,C = int(A,2),int(B,2),int(C,2)
# print(A^B^C,A | B,A | C,B | C)
if (A | B) == (A | C) == (B | C) == N and A^B^C == 0:
print(A,B,C)
else:
print(-1,-1,-1)
# print(A,B,C)