結果
問題 |
No.822 Bitwise AND
|
ユーザー |
![]() |
提出日時 | 2021-01-31 09:28:50 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 373 bytes |
コンパイル時間 | 39 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,544 KB |
最終ジャッジ日時 | 2024-06-28 18:58:38 |
合計ジャッジ時間 | 4,357 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 * 4 && 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