結果
問題 |
No.1463 Hungry Kanten
|
ユーザー |
![]() |
提出日時 | 2021-04-05 04:00:10 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 773 ms / 2,000 ms |
コード長 | 256 bytes |
コンパイル時間 | 99 ms |
コンパイル使用メモリ | 7,968 KB |
実行使用メモリ | 49,608 KB |
最終ジャッジ日時 | 2025-06-20 01:35:47 |
合計ジャッジ時間 | 5,813 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 |
コンパイルメッセージ
Syntax OK
ソースコード
N, K = gets.split.map(&:to_i) A = gets.split.map(&:to_i) def f(nums) nums.sum end def g(nums) nums.inject(:*) end set = Hash.new K.upto(N) do |c| A.combination(c) do |nums| set[f(nums)] = true set[g(nums)] = true end end puts set.size