結果
| 問題 |
No.289 数字を全て足そう
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-05-27 11:17:38 |
| 言語 | Kotlin (2.1.0) |
| 結果 |
AC
|
| 実行時間 | 322 ms / 1,000 ms |
| コード長 | 160 bytes |
| コンパイル時間 | 11,982 ms |
| コンパイル使用メモリ | 433,620 KB |
| 実行使用メモリ | 50,096 KB |
| 最終ジャッジ日時 | 2024-11-20 18:37:23 |
| 合計ジャッジ時間 | 19,824 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
コンパイルメッセージ
Main.kt:5:18: warning: '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: '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: '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
^
ソースコード
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)
}