結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
|
| 提出日時 | 2020-07-05 18:07:57 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 94 ms / 5,000 ms |
| コード長 | 314 bytes |
| コンパイル時間 | 41 ms |
| コンパイル使用メモリ | 7,680 KB |
| 実行使用メモリ | 12,672 KB |
| 最終ジャッジ日時 | 2024-09-22 16:16:04 |
| 合計ジャッジ時間 | 4,223 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
コンパイルメッセージ
Main.rb:7: warning: assigned but unused variable - n Syntax OK
ソースコード
# high = 1
# l = width of big block
# wi = width of each block
# n = count of each block
l = gets.to_i
n = gets.to_i
wi_array = gets.split.map!{|x| x.to_i}
result = 0
# loop
for wi in wi_array.sort
l = l - wi
if l >= 0 then
result += 1
else
break
end
end
print result
exit