結果
| 問題 | No.289 数字を全て足そう |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-31 13:00:00 |
| 言語 | Kotlin (2.3.20) |
| 結果 |
AC
|
| 実行時間 | 349 ms / 1,000 ms |
| コード長 | 254 bytes |
| 記録 | |
| コンパイル時間 | 11,528 ms |
| コンパイル使用メモリ | 459,552 KB |
| 実行使用メモリ | 53,744 KB |
| 最終ジャッジ日時 | 2026-06-02 17:12:32 |
| 合計ジャッジ時間 | 20,597 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
コンパイルメッセージ
Main.kt:5:9: warning: condition is always 'true'.
if (result != null) {
^^^^^^^^^^^^^^
Main.kt:6:35: warning: 'fun <T> Iterable<T>.sumBy(selector: (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)
}
}