結果

問題 No.289 数字を全て足そう
ユーザー TatsuDXTatsuDX
提出日時 2016-09-03 15:23:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 1,000 ms
コード長 329 bytes
コンパイル時間 2,796 ms
コンパイル使用メモリ 76,640 KB
実行使用メモリ 54,212 KB
最終ジャッジ日時 2024-04-27 15:23:54
合計ジャッジ時間 6,396 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
52,984 KB
testcase_01 AC 98 ms
52,844 KB
testcase_02 AC 107 ms
53,932 KB
testcase_03 AC 109 ms
54,212 KB
testcase_04 AC 118 ms
54,016 KB
testcase_05 AC 115 ms
53,916 KB
testcase_06 AC 100 ms
52,512 KB
testcase_07 AC 136 ms
54,120 KB
testcase_08 AC 122 ms
53,744 KB
testcase_09 AC 112 ms
53,552 KB
testcase_10 AC 104 ms
52,628 KB
testcase_11 AC 128 ms
53,680 KB
testcase_12 AC 105 ms
53,852 KB
testcase_13 AC 118 ms
53,572 KB
testcase_14 AC 112 ms
52,848 KB
testcase_15 AC 121 ms
54,052 KB
testcase_16 AC 108 ms
52,772 KB
testcase_17 AC 129 ms
53,888 KB
testcase_18 AC 137 ms
53,912 KB
testcase_19 AC 114 ms
53,056 KB
testcase_20 AC 133 ms
54,016 KB
testcase_21 AC 98 ms
52,596 KB
testcase_22 AC 133 ms
53,868 KB
testcase_23 AC 132 ms
54,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int sum = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) >= '0' && s.charAt(i) <= '9') {
				sum += s.charAt(i) - '0';
			}
		}
		System.out.println(sum);
	}
}
0