結果

問題 No.822 Bitwise AND
ユーザー kohei2019kohei2019
提出日時 2022-04-20 00:12:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 220 ms / 2,000 ms
コード長 374 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 87,320 KB
実行使用メモリ 77,008 KB
最終ジャッジ日時 2023-08-30 22:23:58
合計ジャッジ時間 3,244 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 196 ms
77,008 KB
testcase_01 AC 65 ms
71,364 KB
testcase_02 AC 65 ms
71,420 KB
testcase_03 AC 66 ms
71,260 KB
testcase_04 AC 220 ms
76,492 KB
testcase_05 AC 125 ms
76,368 KB
testcase_06 AC 170 ms
76,460 KB
testcase_07 AC 216 ms
76,576 KB
testcase_08 AC 73 ms
76,104 KB
testcase_09 AC 77 ms
76,312 KB
testcase_10 AC 74 ms
76,352 KB
testcase_11 AC 70 ms
75,600 KB
testcase_12 AC 72 ms
76,432 KB
testcase_13 AC 70 ms
76,340 KB
testcase_14 AC 66 ms
71,576 KB
testcase_15 AC 148 ms
76,300 KB
testcase_16 AC 67 ms
71,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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(2*N):
    for j in range(0,K+1):
        x = i
        y = i+j
        if x & y == N:
            cnt += 1
            if not (len(bin(x)) == len(bin(y))):
                print('INF')
                exit()
print(cnt)
0