結果

問題 No.289 数字を全て足そう
コンテスト
ユーザー Folta
提出日時 2019-05-27 11:17:38
言語 Kotlin
(2.3.20)
コンパイル:
kotlinc _filename_ -include-runtime -d main.jar
実行:
kotlin main.jar
結果
AC  
実行時間 190 ms / 1,000 ms
コード長 160 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 8,997 ms
コンパイル使用メモリ 437,008 KB
実行使用メモリ 51,516 KB
最終ジャッジ日時 2026-05-14 22:01:57
合計ジャッジ時間 14,400 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:5:18: warning: 'fun toInt(): Int' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead.
      if(49 <= i.toInt() && i.toInt() <= 57) sum += i.toInt() -48
                 ^^^^^
Main.kt:5:31: warning: 'fun toInt(): Int' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead.
      if(49 <= i.toInt() && i.toInt() <= 57) sum += i.toInt() -48
                              ^^^^^
Main.kt:5:55: warning: 'fun toInt(): Int' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead.
      if(49 <= i.toInt() && i.toInt() <= 57) sum += i.toInt() -48
                                                      ^^^^^

ソースコード

diff #
raw source code

fun main(){
    val s = readLine()!!
    var sum = 0
    for(i in s){
      if(49 <= i.toInt() && i.toInt() <= 57) sum += i.toInt() -48
    }
    println(sum)
}
0