結果

問題 No.822 Bitwise AND
ユーザー titiatitia
提出日時 2019-04-26 23:19:09
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 354 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 77,004 KB
最終ジャッジ日時 2023-08-16 17:29:50
合計ジャッジ時間 9,512 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,008 ms
76,980 KB
testcase_01 AC 95 ms
76,536 KB
testcase_02 AC 69 ms
76,100 KB
testcase_03 AC 63 ms
71,192 KB
testcase_04 AC 707 ms
76,628 KB
testcase_05 AC 410 ms
76,476 KB
testcase_06 AC 635 ms
76,720 KB
testcase_07 AC 708 ms
76,664 KB
testcase_08 AC 779 ms
76,728 KB
testcase_09 AC 675 ms
76,748 KB
testcase_10 WA -
testcase_11 AC 64 ms
71,380 KB
testcase_12 AC 804 ms
76,676 KB
testcase_13 AC 78 ms
76,156 KB
testcase_14 AC 62 ms
71,060 KB
testcase_15 AC 421 ms
76,544 KB
testcase_16 AC 85 ms
76,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N,K=map(int,input().split())

if N==0 and K!=0:
    print("INF")
    sys.exit()

MAX=0
for i in range(30):
    if (1<<i) &N!=0:
        MAX=i


if K>=(1<<(MAX+1)):
    print("INF")
    sys.exit()   
    
ANS=0
for x in range(N,10**6):
    for i in range(K+1):
        if x & (x+i)==N:
            ANS+=1

print(ANS)
0