結果

問題 No.289 数字を全て足そう
ユーザー ryosuke0825ryosuke0825
提出日時 2018-04-07 21:45:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 206 ms / 1,000 ms
コード長 348 bytes
コンパイル時間 4,491 ms
コンパイル使用メモリ 72,076 KB
実行使用メモリ 59,372 KB
最終ジャッジ日時 2023-09-08 18:16:00
合計ジャッジ時間 8,736 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
56,288 KB
testcase_01 AC 114 ms
55,588 KB
testcase_02 AC 113 ms
55,684 KB
testcase_03 AC 112 ms
55,816 KB
testcase_04 AC 115 ms
56,364 KB
testcase_05 AC 155 ms
58,292 KB
testcase_06 AC 150 ms
56,284 KB
testcase_07 AC 195 ms
59,372 KB
testcase_08 AC 191 ms
59,300 KB
testcase_09 AC 148 ms
58,688 KB
testcase_10 AC 167 ms
58,476 KB
testcase_11 AC 181 ms
58,736 KB
testcase_12 AC 203 ms
58,932 KB
testcase_13 AC 179 ms
58,800 KB
testcase_14 AC 197 ms
58,912 KB
testcase_15 AC 185 ms
59,032 KB
testcase_16 AC 178 ms
59,048 KB
testcase_17 AC 191 ms
59,032 KB
testcase_18 AC 200 ms
59,088 KB
testcase_19 AC 191 ms
59,228 KB
testcase_20 AC 201 ms
58,908 KB
testcase_21 AC 117 ms
57,984 KB
testcase_22 AC 206 ms
58,764 KB
testcase_23 AC 170 ms
56,476 KB
権限があれば一括ダウンロードができます

ソースコード

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