結果

問題 No.617 Nafmo、買い出しに行く
ユーザー mizocodermizocoder
提出日時 2018-07-12 21:29:39
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 260 bytes
コンパイル時間 128 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 19,492 KB
最終ジャッジ日時 2024-04-15 00:35:00
合計ジャッジ時間 5,472 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
19,228 KB
testcase_01 AC 90 ms
12,288 KB
testcase_02 AC 106 ms
12,288 KB
testcase_03 AC 471 ms
12,288 KB
testcase_04 AC 92 ms
12,160 KB
testcase_05 AC 877 ms
12,544 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, k = gets.split.map(&:to_i)
array = []
ans = 0

n.times do
	array << gets.to_i
end

0.upto(2**n-1) do |i|
	temp = 0
	num = "%0#{n}d" % i.to_s(2)

	n.times do |j|
		temp += array[j] if num[j] == "1"
	end

	ans = temp if ans < temp && temp <= k
end

puts ans

0