結果

問題 No.617 Nafmo、買い出しに行く
ユーザー 💕💖💞💕💖💞
提出日時 2018-02-17 09:18:15
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 311 bytes
コンパイル時間 12,242 ms
コンパイル使用メモリ 437,696 KB
実行使用メモリ 60,508 KB
最終ジャッジ日時 2024-04-30 16:58:56
合計ジャッジ時間 21,160 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 336 ms
60,244 KB
testcase_01 AC 336 ms
60,508 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 337 ms
60,400 KB
testcase_06 AC 372 ms
60,368 KB
testcase_07 AC 340 ms
60,400 KB
testcase_08 AC 324 ms
57,076 KB
testcase_09 AC 337 ms
60,284 KB
testcase_10 AC 343 ms
60,260 KB
testcase_11 AC 337 ms
60,280 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 341 ms
60,284 KB
testcase_16 AC 344 ms
60,360 KB
testcase_17 AC 341 ms
60,124 KB
testcase_18 AC 327 ms
56,972 KB
testcase_19 AC 326 ms
57,100 KB
testcase_20 AC 334 ms
60,248 KB
testcase_21 AC 335 ms
60,256 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args:Array<String>) {
         ^

ソースコード

diff #

fun main(args:Array<String>) {
  val (n, k) = readLine()!!.split(" ").map{ it.toInt() }
  val a = (1..n).map { 
    readLine()!!.toInt()
  }.sorted().reversed().toMutableList()

  var s = 0
  for(b in a) {
    if( s < k )  {
      if( b+s <= k ) 
        s = s + b
    }
    else 
      break
  }
  println(s)
}
0