結果

問題 No.289 数字を全て足そう
ユーザー ryosuke0825
提出日時 2018-04-07 21:45:33
言語 Java
(openjdk 23)
結果
AC  
実行時間 207 ms / 1,000 ms
コード長 348 bytes
コンパイル時間 5,239 ms
コンパイル使用メモリ 75,248 KB
実行使用メモリ 57,756 KB
最終ジャッジ日時 2024-06-26 11:07:49
合計ジャッジ時間 9,378 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No289 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String[] arr = S.split("");

		int sum = -1;
		for(String s:arr) {
			try {
				sum += Integer.parseInt(s);
			} catch(NumberFormatException e) {

			}
		}

		System.out.println(sum+1);
	}

}
0