結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
vjudge1
|
| 提出日時 | 2025-09-04 16:54:55 |
| 言語 | Crystal (1.14.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 358 bytes |
| コンパイル時間 | 12,290 ms |
| コンパイル使用メモリ | 311,992 KB |
| 実行使用メモリ | 7,840 KB |
| 最終ジャッジ日時 | 2025-09-04 16:55:13 |
| 合計ジャッジ時間 | 13,870 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 34 |
ソースコード
# Read k and n from first line
input_line = gets.not_nil!.split.map(&.to_i)
k = input_line[0]
n = input_line[1]
# Read the array from second line
w = gets.not_nil!.split.map(&.to_i)
# Sort the array
w.sort!
# Iterate through the sorted list
result = n
w.each_with_index do |value, i|
k -= value
if k < 0
result = i
break
end
end
puts result
vjudge1