結果

問題 No.289 数字を全て足そう
ユーザー kaoetayakaoetaya
提出日時 2016-11-28 13:30:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 141 ms / 1,000 ms
コード長 357 bytes
コンパイル時間 3,342 ms
コンパイル使用メモリ 72,544 KB
実行使用メモリ 57,692 KB
最終ジャッジ日時 2023-08-18 08:45:31
合計ジャッジ時間 7,516 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,724 KB
testcase_01 AC 115 ms
55,760 KB
testcase_02 AC 116 ms
55,644 KB
testcase_03 AC 115 ms
55,364 KB
testcase_04 AC 115 ms
55,656 KB
testcase_05 AC 122 ms
55,896 KB
testcase_06 AC 119 ms
55,728 KB
testcase_07 AC 132 ms
55,832 KB
testcase_08 AC 133 ms
56,024 KB
testcase_09 AC 125 ms
55,888 KB
testcase_10 AC 128 ms
55,768 KB
testcase_11 AC 131 ms
57,692 KB
testcase_12 AC 131 ms
56,384 KB
testcase_13 AC 133 ms
55,792 KB
testcase_14 AC 138 ms
55,776 KB
testcase_15 AC 130 ms
55,740 KB
testcase_16 AC 131 ms
55,800 KB
testcase_17 AC 129 ms
55,548 KB
testcase_18 AC 132 ms
55,764 KB
testcase_19 AC 131 ms
55,940 KB
testcase_20 AC 128 ms
55,948 KB
testcase_21 AC 117 ms
55,516 KB
testcase_22 AC 132 ms
55,820 KB
testcase_23 AC 141 ms
55,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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