結果

問題 No.289 数字を全て足そう
ユーザー kuramubonnkuramubonn
提出日時 2023-02-01 21:58:41
言語 Java19
(openjdk 21)
結果
AC  
実行時間 136 ms / 1,000 ms
コード長 410 bytes
コンパイル時間 1,993 ms
コンパイル使用メモリ 71,484 KB
実行使用メモリ 56,332 KB
最終ジャッジ日時 2023-09-14 07:39:47
合計ジャッジ時間 6,403 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
56,016 KB
testcase_01 AC 117 ms
56,024 KB
testcase_02 AC 118 ms
55,476 KB
testcase_03 AC 118 ms
55,916 KB
testcase_04 AC 117 ms
55,440 KB
testcase_05 AC 125 ms
56,004 KB
testcase_06 AC 124 ms
56,168 KB
testcase_07 AC 133 ms
55,732 KB
testcase_08 AC 132 ms
55,844 KB
testcase_09 AC 123 ms
54,324 KB
testcase_10 AC 130 ms
55,728 KB
testcase_11 AC 131 ms
55,972 KB
testcase_12 AC 136 ms
56,176 KB
testcase_13 AC 130 ms
56,052 KB
testcase_14 AC 134 ms
56,156 KB
testcase_15 AC 130 ms
55,812 KB
testcase_16 AC 130 ms
55,932 KB
testcase_17 AC 131 ms
55,996 KB
testcase_18 AC 133 ms
55,876 KB
testcase_19 AC 132 ms
56,224 KB
testcase_20 AC 132 ms
54,124 KB
testcase_21 AC 120 ms
55,820 KB
testcase_22 AC 133 ms
56,092 KB
testcase_23 AC 135 ms
56,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] Array = sc.next().toCharArray();
		int total = 0;
		for(char ch:Array) {
			if(ch == '1' || ch == '2' || ch == '3' || ch == '4' || ch == '5' || ch == '6' || ch == '7' || ch == '8' || ch == '9') {
				total += Character.getNumericValue(ch);
			}
		}
		System.out.println(total);
	}
}
0