結果

問題 No.822 Bitwise AND
コンテスト
ユーザー kohei2019
提出日時 2022-04-20 00:13:51
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 154 ms / 2,000 ms
+ 561µs
コード長 376 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 87 ms
コンパイル使用メモリ 64,968 KB
実行使用メモリ 58,748 KB
最終ジャッジ日時 2026-10-16 15:35:50
合計ジャッジ時間 3,040 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N,K = map(int,input().split())
ans = 0
if N == 0 and K ==0:
    print(1)
    exit()
if N == 0 and 0 < K:
    print('INF')
    exit()
cnt = 0
for i in range(N+1):
    for j in range(0,K+1):
        x = i+N
        y = x+j
        if x & y == N:
            cnt += 1
            if not (len(bin(x)) == len(bin(y))):
                print('INF')
                exit()
print(cnt)
0