結果

問題 No.9011 数字を全て足そう(数字だけ)
ユーザー matsumomatsumo
提出日時 2020-11-14 22:32:49
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 306 ms / 2,000 ms
コード長 787 bytes
コンパイル時間 15,416 ms
コンパイル使用メモリ 425,732 KB
実行使用メモリ 52,988 KB
最終ジャッジ日時 2023-09-30 06:36:53
合計ジャッジ時間 24,508 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 292 ms
52,500 KB
testcase_01 AC 298 ms
52,752 KB
testcase_02 AC 293 ms
52,672 KB
testcase_03 AC 288 ms
52,688 KB
testcase_04 AC 294 ms
52,620 KB
testcase_05 AC 293 ms
52,880 KB
testcase_06 AC 296 ms
52,848 KB
testcase_07 AC 295 ms
52,888 KB
testcase_08 AC 300 ms
52,920 KB
testcase_09 AC 306 ms
52,516 KB
testcase_10 AC 296 ms
52,640 KB
testcase_11 AC 298 ms
52,684 KB
testcase_12 AC 297 ms
52,584 KB
testcase_13 AC 293 ms
52,856 KB
testcase_14 AC 299 ms
52,848 KB
testcase_15 AC 290 ms
52,768 KB
testcase_16 AC 287 ms
52,780 KB
testcase_17 AC 294 ms
52,520 KB
testcase_18 AC 291 ms
52,524 KB
testcase_19 AC 291 ms
52,988 KB
testcase_20 AC 293 ms
52,664 KB
testcase_21 AC 289 ms
52,536 KB
testcase_22 AC 290 ms
52,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use {
        out.use {
//        repeat(readInteger()) { solve() }
            solve()
            out.flush()
        }
    }
}

fun solve() {
    val s = br.readLine()!!.map { it - '0' }.sum()
    out.println(s)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)
0