結果

問題 No.1463 Hungry Kanten
コンテスト
ユーザー phocom
提出日時 2021-04-02 21:33:58
言語 Ruby
(4.0.2)
コンパイル:
ruby -w -c _filename_
実行:
ruby _filename_
結果
AC  
実行時間 630 ms / 2,000 ms
+ 110µs
コード長 238 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 419 ms
コンパイル使用メモリ 9,352 KB
実行使用メモリ 42,436 KB
最終ジャッジ日時 2026-07-12 08:53:31
合計ジャッジ時間 6,026 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:14: warning: mismatched indentations at 'end' with 'if' at 10
Syntax OK

ソースコード

diff #
raw source code

N,K=gets.split.map &:to_i
A=gets.split.map &:to_i
require 'set'
ans = Set.new
(2**N).times{|b|
  s=0
  m=1
  c=0
  N.times{|i|
    if b[i]==1 then
		s+=A[i]
		m*=A[i]
		c+=1
	end
  }
  if c >= K then
	ans << s
	ans << m
  end
}
p ans.size
0