結果
| 問題 |
No.822 Bitwise AND
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 15:52:31 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 467 bytes |
| コンパイル時間 | 337 ms |
| コンパイル使用メモリ | 82,916 KB |
| 実行使用メモリ | 62,060 KB |
| 最終ジャッジ日時 | 2025-06-12 15:52:33 |
| 合計ジャッジ時間 | 1,844 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 WA * 3 |
ソースコード
N, K = map(int, input().split())
if N == 0:
if K == 0:
print(1)
else:
print("INF")
else:
count = 0
max_x = N + 2 * K # Covering x up to N + 2K to handle all possible y = x + K
for x in range(N, max_x + 1):
if (x & N) != N:
continue # x must have all bits of N set
max_y = min(x + K, max_x)
for y in range(x, max_y + 1):
if (x & y) == N:
count += 1
print(count)
gew1fw