結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2023-05-10 15:46:53 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 409 ms / 5,000 ms |
コード長 | 487 bytes |
コンパイル時間 | 14,230 ms |
コンパイル使用メモリ | 431,496 KB |
実行使用メモリ | 56,500 KB |
最終ジャッジ日時 | 2024-11-26 21:03:04 |
合計ジャッジ時間 | 27,345 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used fun main(args: Array<String>) { ^
ソースコード
fun main(args: Array<String>) { var bigBox = readLine()!!.toInt() var numOfSmallBox = readLine()!!.toInt() var smallBoxes = readLine()!!.split(" ").map { it.toInt() } val sorted = smallBoxes.sorted() var boxList = mutableListOf<Int>() var total = 0 for (i in 0 until numOfSmallBox) { total += sorted[i] if (total > bigBox) { break } else { boxList.add(sorted[i]) } } println(boxList.size) }