結果
| 問題 |
No.939 and or
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-12-07 02:41:51 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 2,000 ms |
| コード長 | 469 bytes |
| コンパイル時間 | 103 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-12-24 06:29:10 |
| 合計ジャッジ時間 | 1,806 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 30 |
ソースコード
from sys import stdin
def main():
input = lambda: stdin.readline()[:-1]
A, B = map(int, input().split())
if A & B != A or A | B != B:
print(0)
return
elif A == B:
print(1)
return
i, n = 0, 0
max_ = max(A, B)
while max_ > 0:
ai = A & 1 << i
bi = B & 1 << i
if (not ai and bi) or (ai and not bi):
n += 1
max_ //= 2
i += 1
print(2 ** (n - 1))
main()