結果
問題 | No.164 ちっちゃくないよ!! |
ユーザー | バカらっく |
提出日時 | 2019-11-26 03:18:47 |
言語 | Kotlin (1.9.23) |
結果 |
AC
|
実行時間 | 368 ms / 2,000 ms |
コード長 | 506 bytes |
コンパイル時間 | 13,257 ms |
コンパイル使用メモリ | 442,988 KB |
実行使用メモリ | 52,876 KB |
最終ジャッジ日時 | 2024-04-23 14:25:11 |
合計ジャッジ時間 | 18,147 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 314 ms
52,096 KB |
testcase_01 | AC | 315 ms
52,256 KB |
testcase_02 | AC | 320 ms
51,868 KB |
testcase_03 | AC | 316 ms
51,968 KB |
testcase_04 | AC | 317 ms
52,120 KB |
testcase_05 | AC | 361 ms
52,428 KB |
testcase_06 | AC | 368 ms
52,832 KB |
testcase_07 | AC | 364 ms
52,536 KB |
testcase_08 | AC | 359 ms
52,508 KB |
testcase_09 | AC | 360 ms
52,876 KB |
testcase_10 | AC | 324 ms
52,164 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 ^
ソースコード
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; }