結果

問題 No.164 ちっちゃくないよ!!
ユーザー バカらっくバカらっく
提出日時 2019-11-26 03:18:47
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 336 ms / 2,000 ms
コード長 506 bytes
コンパイル時間 12,906 ms
コンパイル使用メモリ 421,760 KB
実行使用メモリ 53,332 KB
最終ジャッジ日時 2023-08-05 17:34:41
合計ジャッジ時間 17,545 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 290 ms
52,936 KB
testcase_01 AC 292 ms
53,028 KB
testcase_02 AC 295 ms
52,864 KB
testcase_03 AC 293 ms
53,124 KB
testcase_04 AC 295 ms
53,104 KB
testcase_05 AC 332 ms
53,232 KB
testcase_06 AC 336 ms
53,316 KB
testcase_07 AC 331 ms
53,172 KB
testcase_08 AC 332 ms
53,332 KB
testcase_09 AC 332 ms
53,224 KB
testcase_10 AC 298 ms
52,880 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:2:10: warning: parameter 'arr' is never used
fun main(arr:Array<String>) {
         ^
Main.kt:4:67: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Long
    val ans = (1..inputCount).map { getValue(readLine()!!) }.min()!!
                                                                  ^
Main.kt:9:34: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Char
    val max = charToInt(num.max()!!) + 1L
                                 ^

ソースコード

diff #

fun main(arr:Array<String>) {
    val inputCount = readLine()!!.toInt()
    val ans = (1..inputCount).map { getValue(readLine()!!) }.min()!!
    println(ans)
}

fun getValue(num:String):Long {
    val max = charToInt(num.max()!!) + 1L
    var base = 1L
    var total = 0L
    for(c in num.reversed()) {
        total += base * charToInt(c)
        base *= max
    }
    return total
}

fun charToInt(c:Char):Int {
    if(c <= '9') {
        return c.toString().toInt();
    }
    return (c - 'A') + 10;
}
0