結果

問題 No.289 数字を全て足そう
ユーザー rutilicusrutilicus
提出日時 2020-08-30 21:41:59
言語 Kotlin
(2.1.0)
結果
AC  
実行時間 330 ms / 1,000 ms
コード長 284 bytes
コンパイル時間 10,338 ms
コンパイル使用メモリ 426,372 KB
実行使用メモリ 57,040 KB
最終ジャッジ日時 2024-11-15 15:32:30
合計ジャッジ時間 18,920 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
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