結果

問題 No.289 数字を全て足そう
ユーザー econo_coffee
提出日時 2017-03-28 22:40:10
言語 Java
(openjdk 23)
結果
AC  
実行時間 127 ms / 1,000 ms
コード長 379 bytes
コンパイル時間 3,042 ms
コンパイル使用メモリ 76,824 KB
実行使用メモリ 41,612 KB
最終ジャッジ日時 2024-07-06 13:31:34
合計ジャッジ時間 6,529 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import java .util.Scanner;
public class Yukicoder {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		char[] array = s.toCharArray();
		int sum = 0;
		for (int i = 0; i < s.length(); i++) {
			if (array[i] >= '0' && array[i] <= '9') {
				sum += Integer.parseInt("" + array[i]);
			}
		}
		System.out.print(sum);

	}

}
0