結果
問題 |
No.1046 Fruits Rush
|
ユーザー |
|
提出日時 | 2021-04-10 23:44:29 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 328 ms / 2,000 ms |
コード長 | 268 bytes |
コンパイル時間 | 11,962 ms |
コンパイル使用メモリ | 438,808 KB |
実行使用メモリ | 60,712 KB |
最終ジャッジ日時 | 2024-06-26 20:50:20 |
合計ジャッジ時間 | 18,660 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
コンパイルメッセージ
Main.kt:2:10: warning: variable 'n' is never used val (n, k) = readLine()!!.split(" ").map{it.toInt()} ^
ソースコード
fun main() { val (n, k) = readLine()!!.split(" ").map{it.toInt()} println(readLine()!!.split(" ").map{it.toInt()}.sorted().reversed().take(k).let{ if(it.first() < 0) it.first() else it.sumOf{it2 -> 0.coerceAtLeast(it2)} }) }