結果

問題 No.289 数字を全て足そう
ユーザー aaaaasatoriaaaaasatori
提出日時 2018-02-05 08:38:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 157 ms / 1,000 ms
コード長 348 bytes
コンパイル時間 4,440 ms
コンパイル使用メモリ 74,184 KB
実行使用メモリ 57,600 KB
最終ジャッジ日時 2023-09-20 11:15:34
合計ジャッジ時間 8,529 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,532 KB
testcase_01 AC 124 ms
55,736 KB
testcase_02 AC 125 ms
55,996 KB
testcase_03 AC 119 ms
55,596 KB
testcase_04 AC 124 ms
56,116 KB
testcase_05 AC 135 ms
55,912 KB
testcase_06 AC 128 ms
56,104 KB
testcase_07 AC 142 ms
55,692 KB
testcase_08 AC 143 ms
55,740 KB
testcase_09 AC 131 ms
55,476 KB
testcase_10 AC 144 ms
55,884 KB
testcase_11 AC 147 ms
55,524 KB
testcase_12 AC 151 ms
56,176 KB
testcase_13 AC 144 ms
55,860 KB
testcase_14 AC 150 ms
55,776 KB
testcase_15 AC 145 ms
55,724 KB
testcase_16 AC 146 ms
55,596 KB
testcase_17 AC 148 ms
57,600 KB
testcase_18 AC 145 ms
53,952 KB
testcase_19 AC 143 ms
55,836 KB
testcase_20 AC 141 ms
56,012 KB
testcase_21 AC 122 ms
55,400 KB
testcase_22 AC 147 ms
56,052 KB
testcase_23 AC 157 ms
55,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No289 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		int sum = 0;
		
		for(int i = 0;i < str.length();i++) {
			if(Character.isDigit(str.charAt(i))) {
				sum += Integer.parseInt("" + str.charAt(i));
			}
		}
		
		System.out.println(sum);
	}
}
0