結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
💕💖💞
|
| 提出日時 | 2017-04-08 15:46:50 |
| 言語 | Kotlin (2.1.0) |
| 結果 |
AC
|
| 実行時間 | 466 ms / 5,000 ms |
| コード長 | 324 bytes |
| コンパイル時間 | 12,202 ms |
| コンパイル使用メモリ | 429,852 KB |
| 実行使用メモリ | 58,696 KB |
| 最終ジャッジ日時 | 2024-11-20 07:55:32 |
| 合計ジャッジ時間 | 26,373 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String> ) {
^
Main.kt:3:7: warning: variable 'N' is never used
val N = readLine()!!.toInt()
^
ソースコード
fun main(args: Array<String> ) {
val L = readLine()!!.toInt()
val N = readLine()!!.toInt()
var acc = 0
val ws = readLine()!!.split(" ").map { x ->
x.toInt()
}.sortedBy { x ->
x
}.filter { x ->
acc += x
if(acc <= L ) {
true
} else {
false
}
}
println(ws.size)
}
💕💖💞