結果
| 問題 |
No.822 Bitwise AND
|
| コンテスト | |
| ユーザー |
yuruhiya
|
| 提出日時 | 2020-09-01 17:45:35 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 369 bytes |
| コンパイル時間 | 377 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 12,672 KB |
| 最終ジャッジ日時 | 2024-06-25 18:21:55 |
| 合計ジャッジ時間 | 3,373 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 WA * 1 |
コンパイルメッセージ
Syntax OK
ソースコード
n, k = gets.split.map &:to_i
if k == 0
puts 1
else
if n + 1 <= k
puts 'INF'
else
bits = (0..30).select { |i| 2**i <= k && n[i] == 0 }.map { 2**_1 }
puts [0, 1, 2].repeated_permutation(bits.size).count { |i|
x = i.each_with_index.sum { _1 == 1 ? bits[_2] : 0 }
y = i.each_with_index.sum { _1 == 2 ? bits[_2] : 0 }
(0..k) === y - x
}
end
end
yuruhiya