結果

問題 No.1463 Hungry Kanten
ユーザー phocom
提出日時 2021-04-02 21:33:58
言語 Ruby
(3.4.1)
結果
AC  
実行時間 1,077 ms / 2,000 ms
コード長 238 bytes
コンパイル時間 464 ms
コンパイル使用メモリ 7,968 KB
実行使用メモリ 45,616 KB
最終ジャッジ日時 2025-06-20 01:31:23
合計ジャッジ時間 8,557 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:14: warning: mismatched indentations at 'end' with 'if' at 10
Syntax OK

ソースコード

diff #

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