結果

問題 No.289 数字を全て足そう
ユーザー rutilicusrutilicus
提出日時 2020-08-30 21:41:59
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 321 ms / 1,000 ms
コード長 284 bytes
コンパイル時間 9,917 ms
コンパイル使用メモリ 425,536 KB
実行使用メモリ 56,956 KB
最終ジャッジ日時 2024-04-27 13:23:24
合計ジャッジ時間 18,385 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 278 ms
56,840 KB
testcase_01 AC 280 ms
56,872 KB
testcase_02 AC 294 ms
56,752 KB
testcase_03 AC 280 ms
56,828 KB
testcase_04 AC 281 ms
56,848 KB
testcase_05 AC 297 ms
56,844 KB
testcase_06 AC 289 ms
56,840 KB
testcase_07 AC 315 ms
56,704 KB
testcase_08 AC 312 ms
56,820 KB
testcase_09 AC 287 ms
56,816 KB
testcase_10 AC 299 ms
56,764 KB
testcase_11 AC 303 ms
56,740 KB
testcase_12 AC 317 ms
56,904 KB
testcase_13 AC 298 ms
56,776 KB
testcase_14 AC 321 ms
56,932 KB
testcase_15 AC 310 ms
56,856 KB
testcase_16 AC 288 ms
56,804 KB
testcase_17 AC 304 ms
56,904 KB
testcase_18 AC 312 ms
56,856 KB
testcase_19 AC 306 ms
56,900 KB
testcase_20 AC 318 ms
56,848 KB
testcase_21 AC 281 ms
56,720 KB
testcase_22 AC 313 ms
56,952 KB
testcase_23 AC 315 ms
56,956 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:12:13: warning: 'appendln(Int): kotlin.text.StringBuilder /* = java.lang.StringBuilder */' is deprecated. Use appendLine instead. Note that the new method always appends the line feed character '\n' regardless of the system line separator.
    builder.appendln(ans)
            ^

ソースコード

diff #

fun main() {
    val builder = StringBuilder()

    var ans = 0

    readInputLine().forEach {
        if (it.isDigit()) {
            ans += it - '0'
        }
    }

    builder.appendln(ans)

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}
0