結果

問題 No.289 数字を全て足そう
ユーザー uchida_tuchida_t
提出日時 2023-05-31 13:06:14
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 388 ms / 1,000 ms
コード長 259 bytes
コンパイル時間 14,227 ms
コンパイル使用メモリ 416,780 KB
実行使用メモリ 53,560 KB
最終ジャッジ日時 2023-08-28 01:30:12
合計ジャッジ時間 24,030 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 290 ms
52,392 KB
testcase_01 AC 294 ms
52,860 KB
testcase_02 AC 295 ms
52,636 KB
testcase_03 AC 273 ms
50,188 KB
testcase_04 AC 293 ms
52,608 KB
testcase_05 AC 326 ms
52,932 KB
testcase_06 AC 324 ms
52,888 KB
testcase_07 AC 377 ms
53,432 KB
testcase_08 AC 378 ms
53,544 KB
testcase_09 AC 322 ms
52,812 KB
testcase_10 AC 331 ms
53,172 KB
testcase_11 AC 350 ms
53,072 KB
testcase_12 AC 388 ms
53,552 KB
testcase_13 AC 332 ms
53,160 KB
testcase_14 AC 386 ms
53,392 KB
testcase_15 AC 354 ms
52,988 KB
testcase_16 AC 335 ms
53,220 KB
testcase_17 AC 376 ms
53,560 KB
testcase_18 AC 385 ms
53,320 KB
testcase_19 AC 350 ms
53,184 KB
testcase_20 AC 376 ms
53,344 KB
testcase_21 AC 295 ms
52,652 KB
testcase_22 AC 385 ms
53,240 KB
testcase_23 AC 355 ms
52,900 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

fun main(args: Array<String>) {
    val text = readLine()!!
    val regex = Regex("[^0-9]")
    val result = regex.replace(text, "")
    if (result.isNotEmpty()) {
        println(result.chunked(1).sumOf { it.toInt() })
    } else {
        println(0)
    }
}
0