結果

問題 No.289 数字を全て足そう
ユーザー samplelpmassamplelpmas
提出日時 2016-12-18 11:58:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 1,000 ms
コード長 458 bytes
コンパイル時間 3,352 ms
コンパイル使用メモリ 71,180 KB
実行使用メモリ 56,276 KB
最終ジャッジ日時 2023-08-21 00:44:52
合計ジャッジ時間 7,723 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,888 KB
testcase_01 AC 118 ms
55,972 KB
testcase_02 AC 119 ms
55,876 KB
testcase_03 AC 119 ms
55,400 KB
testcase_04 AC 117 ms
55,608 KB
testcase_05 AC 125 ms
55,684 KB
testcase_06 AC 124 ms
55,808 KB
testcase_07 AC 133 ms
55,956 KB
testcase_08 AC 133 ms
55,720 KB
testcase_09 AC 123 ms
55,864 KB
testcase_10 AC 131 ms
55,712 KB
testcase_11 AC 133 ms
55,816 KB
testcase_12 AC 134 ms
55,704 KB
testcase_13 AC 131 ms
55,720 KB
testcase_14 AC 132 ms
55,464 KB
testcase_15 AC 132 ms
56,276 KB
testcase_16 AC 132 ms
55,492 KB
testcase_17 AC 134 ms
56,060 KB
testcase_18 AC 134 ms
56,260 KB
testcase_19 AC 132 ms
55,512 KB
testcase_20 AC 131 ms
55,904 KB
testcase_21 AC 118 ms
56,168 KB
testcase_22 AC 134 ms
55,960 KB
testcase_23 AC 136 ms
53,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        char[] INPUT_STRING = sc.next().toCharArray();

        int sum = 0;

        for (int i = 0; i < INPUT_STRING.length; i++) {

            if ('0' <= INPUT_STRING[i] && INPUT_STRING[i] <= '9') {
                sum += INPUT_STRING[i] - '0';
            }

        }

        System.out.println(sum);

    }

}
0