結果

問題 No.289 数字を全て足そう
ユーザー dogwood0424dogwood0424
提出日時 2017-11-29 12:17:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 143 ms / 1,000 ms
コード長 343 bytes
コンパイル時間 2,650 ms
コンパイル使用メモリ 73,356 KB
実行使用メモリ 56,356 KB
最終ジャッジ日時 2023-08-18 13:31:06
合計ジャッジ時間 6,735 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
55,832 KB
testcase_01 AC 99 ms
55,776 KB
testcase_02 AC 102 ms
55,768 KB
testcase_03 AC 107 ms
55,524 KB
testcase_04 AC 104 ms
55,768 KB
testcase_05 AC 116 ms
55,552 KB
testcase_06 AC 115 ms
55,584 KB
testcase_07 AC 124 ms
55,732 KB
testcase_08 AC 124 ms
55,860 KB
testcase_09 AC 108 ms
55,776 KB
testcase_10 AC 117 ms
55,744 KB
testcase_11 AC 132 ms
55,884 KB
testcase_12 AC 131 ms
55,980 KB
testcase_13 AC 123 ms
55,736 KB
testcase_14 AC 137 ms
55,920 KB
testcase_15 AC 132 ms
56,016 KB
testcase_16 AC 131 ms
55,864 KB
testcase_17 AC 131 ms
56,356 KB
testcase_18 AC 143 ms
55,596 KB
testcase_19 AC 131 ms
55,744 KB
testcase_20 AC 130 ms
55,944 KB
testcase_21 AC 100 ms
56,000 KB
testcase_22 AC 138 ms
55,784 KB
testcase_23 AC 140 ms
55,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No289 {
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.nextLine();
		int sum = 0;

		for(int i=0;i<S.length();i++) {
			sum += Character.isLetter(S.charAt(i)) ?
					0:Integer.parseInt(String.valueOf(S.charAt(i)));
		}

		System.out.println(sum);

	}

}
0