結果

問題 No.939 and or
ユーザー tails1434
提出日時 2020-01-02 09:22:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 491 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 52,096 KB
最終ジャッジ日時 2024-11-22 17:43:16
合計ジャッジ時間 2,671 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    A, B = map(int, input().split())
    if A > B:
        print(0)
        exit()

    cnt = 1
    for i in range(40):
        if A & (1 << i):
            if B & (1 << i):
                cnt *= 1
            else:
                cnt *= 0
        else:
            if B & (1 << i):
                cnt *= 2
            else:
                cnt *= 1

    if cnt == 1:
        print(cnt)
        exit()
    else:
        print(cnt // 2)



if __name__ == "__main__":
    main()
0