結果

問題 No.289 数字を全て足そう
ユーザー javyjavy
提出日時 2015-11-02 22:33:08
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 341 ms / 1,000 ms
コード長 319 bytes
コンパイル時間 11,678 ms
コンパイル使用メモリ 432,072 KB
実行使用メモリ 50,280 KB
最終ジャッジ日時 2024-04-30 03:02:34
合計ジャッジ時間 20,566 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 306 ms
49,580 KB
testcase_01 AC 298 ms
49,500 KB
testcase_02 AC 307 ms
49,760 KB
testcase_03 AC 309 ms
49,632 KB
testcase_04 AC 304 ms
49,524 KB
testcase_05 AC 306 ms
49,588 KB
testcase_06 AC 293 ms
49,692 KB
testcase_07 AC 321 ms
49,908 KB
testcase_08 AC 327 ms
49,844 KB
testcase_09 AC 313 ms
49,792 KB
testcase_10 AC 316 ms
49,884 KB
testcase_11 AC 324 ms
49,852 KB
testcase_12 AC 341 ms
49,984 KB
testcase_13 AC 316 ms
49,908 KB
testcase_14 AC 341 ms
49,984 KB
testcase_15 AC 325 ms
49,788 KB
testcase_16 AC 315 ms
49,892 KB
testcase_17 AC 328 ms
49,860 KB
testcase_18 AC 335 ms
49,800 KB
testcase_19 AC 334 ms
49,792 KB
testcase_20 AC 322 ms
49,784 KB
testcase_21 AC 301 ms
49,536 KB
testcase_22 AC 328 ms
49,840 KB
testcase_23 AC 332 ms
50,280 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:6:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^
Main.kt:8:17: warning: no cast needed
    var sum = 0 as Int
                ^

ソースコード

diff #

package Yukicoder

/**
 * Created by hichikawa on 2015/11/02.
 */
fun main(args: Array<String>) {
    val str = readLine() as String
    var sum = 0 as Int
    for (ch : Char in str) {
        when (ch) {
            '1','2','3','4','5','6','7','8','9' -> sum += ch.toString().toInt()
        }
    }
    println(sum)
}
0