結果

問題 No.289 数字を全て足そう
ユーザー koukonkokoukonko
提出日時 2015-12-23 16:20:13
言語 Java21
(openjdk 21)
結果
AC  
実行時間 60 ms / 1,000 ms
コード長 527 bytes
コンパイル時間 2,267 ms
コンパイル使用メモリ 74,996 KB
実行使用メモリ 37,320 KB
最終ジャッジ日時 2024-04-16 20:58:42
合計ジャッジ時間 4,341 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
36,876 KB
testcase_01 AC 51 ms
37,012 KB
testcase_02 AC 51 ms
37,032 KB
testcase_03 AC 51 ms
37,000 KB
testcase_04 AC 51 ms
37,316 KB
testcase_05 AC 53 ms
37,236 KB
testcase_06 AC 53 ms
37,184 KB
testcase_07 AC 54 ms
36,792 KB
testcase_08 AC 54 ms
37,320 KB
testcase_09 AC 51 ms
36,768 KB
testcase_10 AC 52 ms
36,960 KB
testcase_11 AC 53 ms
37,104 KB
testcase_12 AC 58 ms
36,964 KB
testcase_13 AC 52 ms
36,788 KB
testcase_14 AC 54 ms
37,016 KB
testcase_15 AC 53 ms
36,852 KB
testcase_16 AC 53 ms
36,700 KB
testcase_17 AC 56 ms
36,880 KB
testcase_18 AC 57 ms
36,632 KB
testcase_19 AC 53 ms
37,184 KB
testcase_20 AC 58 ms
37,104 KB
testcase_21 AC 52 ms
37,188 KB
testcase_22 AC 56 ms
36,972 KB
testcase_23 AC 60 ms
37,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));

		try {
			int count = 0;

			String S = buff.readLine();
			for(int i = 0; i < S.length(); ++i){
				if(S.charAt(i) >= '0' && S.charAt(i) <= '9'){
					count += Character.getNumericValue(S.charAt(i));
				}
			}

			System.out.println(count);
		} catch (Exception e) {
			e.getStackTrace();
		}
	}
}
0