結果

問題 No.289 数字を全て足そう
ユーザー Hiroaki KonoHiroaki Kono
提出日時 2017-10-26 21:20:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 211 ms / 1,000 ms
コード長 455 bytes
コンパイル時間 3,211 ms
コンパイル使用メモリ 75,148 KB
実行使用メモリ 57,888 KB
最終ジャッジ日時 2024-05-01 15:17:04
合計ジャッジ時間 7,844 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
54,076 KB
testcase_01 AC 111 ms
53,748 KB
testcase_02 AC 109 ms
53,304 KB
testcase_03 AC 118 ms
54,092 KB
testcase_04 AC 114 ms
54,016 KB
testcase_05 AC 150 ms
56,460 KB
testcase_06 AC 137 ms
54,684 KB
testcase_07 AC 174 ms
57,344 KB
testcase_08 AC 164 ms
57,380 KB
testcase_09 AC 136 ms
56,464 KB
testcase_10 AC 161 ms
56,356 KB
testcase_11 AC 183 ms
57,492 KB
testcase_12 AC 211 ms
57,308 KB
testcase_13 AC 176 ms
56,936 KB
testcase_14 AC 177 ms
57,464 KB
testcase_15 AC 170 ms
57,084 KB
testcase_16 AC 177 ms
57,216 KB
testcase_17 AC 180 ms
57,340 KB
testcase_18 AC 190 ms
57,888 KB
testcase_19 AC 168 ms
57,344 KB
testcase_20 AC 171 ms
57,368 KB
testcase_21 AC 115 ms
54,064 KB
testcase_22 AC 174 ms
57,344 KB
testcase_23 AC 158 ms
54,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No289 {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String num = s.next();
        int sum = 0;
        String[] c = num.split("");
        for (int i = 0; i < c.length; i++) {
            try {
                sum += Integer.parseInt(c[i]);
            } catch (NumberFormatException ignored) {
            }
        }
        System.out.println(sum);
    }
}
0