結果
問題 |
No.289 数字を全て足そう
|
ユーザー |
|
提出日時 | 2023-05-31 13:00:00 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 436 ms / 1,000 ms |
コード長 | 254 bytes |
コンパイル時間 | 17,968 ms |
コンパイル使用メモリ | 429,592 KB |
実行使用メモリ | 51,780 KB |
最終ジャッジ日時 | 2024-12-28 13:44:35 |
合計ジャッジ時間 | 24,251 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used fun main(args: Array<String>) { ^ Main.kt:5:9: warning: condition 'result != null' is always 'true' if (result != null) { ^ Main.kt:6:35: warning: 'sumBy((T) -> Int): Int' is deprecated. Use sumOf instead. println(result.chunked(1).sumBy { it.toInt() }) ^
ソースコード
fun main(args: Array<String>) { val text = readLine()!! val regex = Regex("[^0-9]") val result = regex.replace(text, "") if (result != null) { println(result.chunked(1).sumBy { it.toInt() }) } else { println(0) } }