結果

問題 No.289 数字を全て足そう
ユーザー tentententen
提出日時 2020-11-11 09:09:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 138 ms / 1,000 ms
コード長 336 bytes
コンパイル時間 2,166 ms
コンパイル使用メモリ 71,748 KB
実行使用メモリ 56,196 KB
最終ジャッジ日時 2023-09-30 00:23:43
合計ジャッジ時間 6,819 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
55,660 KB
testcase_01 AC 112 ms
55,580 KB
testcase_02 AC 109 ms
55,928 KB
testcase_03 AC 113 ms
55,580 KB
testcase_04 AC 114 ms
55,568 KB
testcase_05 AC 122 ms
56,168 KB
testcase_06 AC 117 ms
56,160 KB
testcase_07 AC 124 ms
56,140 KB
testcase_08 AC 128 ms
55,940 KB
testcase_09 AC 118 ms
55,332 KB
testcase_10 AC 125 ms
55,900 KB
testcase_11 AC 130 ms
56,048 KB
testcase_12 AC 128 ms
56,196 KB
testcase_13 AC 128 ms
55,912 KB
testcase_14 AC 130 ms
55,812 KB
testcase_15 AC 129 ms
55,844 KB
testcase_16 AC 129 ms
55,956 KB
testcase_17 AC 127 ms
56,068 KB
testcase_18 AC 135 ms
55,752 KB
testcase_19 AC 138 ms
56,196 KB
testcase_20 AC 133 ms
56,048 KB
testcase_21 AC 117 ms
55,116 KB
testcase_22 AC 131 ms
56,040 KB
testcase_23 AC 132 ms
55,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int ans = 0;
        for (char c : sc.next().toCharArray()) {
            if (c > '0' && c <= '9') {
                ans += c - '0';
            }
        }
        System.out.println(ans);
    }
}
0