結果
| 問題 |
No.939 and or
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-12-04 10:51:36 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 2,000 ms |
| コード長 | 550 bytes |
| コンパイル時間 | 269 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-11-30 01:07:15 |
| 合計ジャッジ時間 | 2,310 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 30 |
ソースコード
A, B = map(int, input().split())
binA = format(A, 'b')
binB = format(B, 'b')
if len(binA)<=len(binB):
binA = '0'*(len(binB)-len(binA))+binA
else:
binB = '0'*(len(binA)-len(binB))+binB
c1, c2, c3, c4 = 0, 0, 0, 0
for binA_i, binB_i in zip(binA, binB):
if binA_i=='1' and binB_i=='1':
c1 += 1
elif binA_i=='1' and binB_i=='0':
c2 += 1
elif binA_i=='0' and binB_i=='1':
c3 += 1
elif binA_i=='0' and binB_i=='0':
c4 += 1
if c2>0:
print(0)
elif c3==0:
print(1)
else:
print(2**(c3-1))