結果

問題 No.939 and or
コンテスト
ユーザー tnodino
提出日時 2022-08-10 21:08:35
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 399 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 490 ms
コンパイル使用メモリ 20,824 KB
実行使用メモリ 15,484 KB
最終ジャッジ日時 2026-04-09 14:15:03
合計ジャッジ時間 4,572 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

A,B = map(int,input().split())
if A == B:
    print(1)
    exit()
bit1 = [0] * 32
bit2 = [0] * 32
for i in range(32):
    if A & (1 << i):
        bit1[i] = 1
for i in range(32):
    if B & (1 << i):
        bit2[i] = 1
cnt = 0
for i in range(31,-1,-1):
    if bit1[i] == 1 and bit2[i] == 0:
        print(0)
        exit()
    if bit1[i] == 0 and bit2[i] == 1:
        cnt += 1
print(pow(2, cnt-1))
0