結果

問題 No.289 数字を全て足そう
ユーザー fukuseifukusei
提出日時 2017-05-17 16:01:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 179 ms / 1,000 ms
コード長 333 bytes
コンパイル時間 3,562 ms
コンパイル使用メモリ 76,696 KB
実行使用メモリ 58,560 KB
最終ジャッジ日時 2023-10-17 23:54:09
合計ジャッジ時間 8,596 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
57,420 KB
testcase_01 AC 131 ms
57,432 KB
testcase_02 AC 118 ms
56,292 KB
testcase_03 AC 128 ms
57,096 KB
testcase_04 AC 126 ms
57,384 KB
testcase_05 AC 165 ms
58,216 KB
testcase_06 AC 144 ms
57,972 KB
testcase_07 AC 174 ms
58,320 KB
testcase_08 AC 163 ms
58,372 KB
testcase_09 AC 162 ms
58,412 KB
testcase_10 AC 170 ms
58,304 KB
testcase_11 AC 175 ms
58,128 KB
testcase_12 AC 174 ms
58,560 KB
testcase_13 AC 169 ms
58,388 KB
testcase_14 AC 175 ms
58,360 KB
testcase_15 AC 170 ms
58,428 KB
testcase_16 AC 172 ms
58,248 KB
testcase_17 AC 173 ms
58,244 KB
testcase_18 AC 175 ms
58,268 KB
testcase_19 AC 175 ms
58,428 KB
testcase_20 AC 171 ms
58,208 KB
testcase_21 AC 141 ms
57,348 KB
testcase_22 AC 179 ms
58,284 KB
testcase_23 AC 154 ms
57,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*; 

public class test {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String str = sc.next();
		String a = str.replaceAll("[^0-9]","");
		int sum = 0;
		
		for(int i=0; i<a.length(); i++ ){
			sum = sum + Integer.parseInt("" + a.charAt(i));
		}
		System.out.println(sum);
	}
}
0