結果

問題 No.289 数字を全て足そう
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-14 09:58:13
言語 Java21
(openjdk 21)
結果
AC  
実行時間 149 ms / 1,000 ms
コード長 331 bytes
コンパイル時間 2,304 ms
コンパイル使用メモリ 77,652 KB
実行使用メモリ 43,016 KB
最終ジャッジ日時 2024-04-28 19:01:58
合計ジャッジ時間 6,137 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
42,760 KB
testcase_01 AC 123 ms
43,016 KB
testcase_02 AC 109 ms
39,864 KB
testcase_03 AC 122 ms
40,976 KB
testcase_04 AC 123 ms
41,004 KB
testcase_05 AC 116 ms
40,064 KB
testcase_06 AC 129 ms
41,172 KB
testcase_07 AC 147 ms
41,232 KB
testcase_08 AC 139 ms
41,224 KB
testcase_09 AC 130 ms
41,576 KB
testcase_10 AC 147 ms
41,300 KB
testcase_11 AC 140 ms
41,460 KB
testcase_12 AC 139 ms
41,360 KB
testcase_13 AC 145 ms
41,380 KB
testcase_14 AC 149 ms
41,252 KB
testcase_15 AC 149 ms
41,236 KB
testcase_16 AC 136 ms
41,332 KB
testcase_17 AC 138 ms
41,256 KB
testcase_18 AC 128 ms
40,376 KB
testcase_19 AC 148 ms
41,120 KB
testcase_20 AC 125 ms
39,924 KB
testcase_21 AC 130 ms
41,232 KB
testcase_22 AC 142 ms
41,336 KB
testcase_23 AC 143 ms
41,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

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