結果

問題 No.1628 Sorting Integers (MAX of M)
ユーザー バカらっくバカらっく
提出日時 2022-02-03 12:23:56
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 305 ms / 2,000 ms
コード長 431 bytes
コンパイル時間 13,012 ms
コンパイル使用メモリ 425,272 KB
実行使用メモリ 53,216 KB
最終ジャッジ日時 2023-09-02 03:09:16
合計ジャッジ時間 16,728 ms
ジャッジサーバーID
(参考情報)
judge16 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 296 ms
52,972 KB
testcase_01 AC 294 ms
52,968 KB
testcase_02 AC 294 ms
52,928 KB
testcase_03 AC 298 ms
52,968 KB
testcase_04 AC 305 ms
52,976 KB
testcase_05 AC 290 ms
52,788 KB
testcase_06 AC 296 ms
52,956 KB
testcase_07 AC 292 ms
53,080 KB
testcase_08 AC 294 ms
53,216 KB
testcase_09 AC 293 ms
53,020 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:3:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^
Main.kt:4:9: warning: variable 'n' is never used
    val n = readLine()!!.toInt()
        ^

ソースコード

diff #

import java.lang.StringBuilder

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val c = readLine()!!.split(" ").map { it.toInt() }
    var ans = ""
    c.indices.reversed().forEach { idx ->
        c[idx].let { cnt ->
            if(cnt > 0) {
                (idx+1).toString()[0].let { num ->
                    ans += "".padStart(cnt, num)
                }
            }
        }
    }
    println(ans)
}
0