結果

問題 No.289 数字を全て足そう
ユーザー HEGO55HEGO55
提出日時 2017-05-17 15:53:25
言語 Java21
(openjdk 21)
結果
AC  
実行時間 139 ms / 1,000 ms
コード長 413 bytes
コンパイル時間 4,929 ms
コンパイル使用メモリ 73,644 KB
実行使用メモリ 57,628 KB
最終ジャッジ日時 2023-10-17 23:53:54
合計ジャッジ時間 7,288 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
57,488 KB
testcase_01 AC 110 ms
55,428 KB
testcase_02 AC 121 ms
57,208 KB
testcase_03 AC 124 ms
57,628 KB
testcase_04 AC 123 ms
57,364 KB
testcase_05 AC 129 ms
57,568 KB
testcase_06 AC 126 ms
57,516 KB
testcase_07 AC 136 ms
57,460 KB
testcase_08 AC 136 ms
57,604 KB
testcase_09 AC 117 ms
56,208 KB
testcase_10 AC 137 ms
57,320 KB
testcase_11 AC 137 ms
57,364 KB
testcase_12 AC 139 ms
57,576 KB
testcase_13 AC 123 ms
56,312 KB
testcase_14 AC 139 ms
57,120 KB
testcase_15 AC 138 ms
57,368 KB
testcase_16 AC 134 ms
57,392 KB
testcase_17 AC 123 ms
56,316 KB
testcase_18 AC 138 ms
57,528 KB
testcase_19 AC 134 ms
57,504 KB
testcase_20 AC 134 ms
57,220 KB
testcase_21 AC 120 ms
57,628 KB
testcase_22 AC 126 ms
56,668 KB
testcase_23 AC 136 ms
57,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class Test38{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String str = sc.next();
		char[] c = str.toCharArray();
		int sum = 0;
		
		for(int i=0; i<c.length; i++){
			if(c[i]=='0'||c[i]=='1'||c[i]=='2'||c[i]=='3'||c[i]=='4'||c[i]=='5'||c[i]=='6'||c[i]=='7'||c[i]=='8'||c[i]=='9'){
				sum += (int)(c[i])-48;
			}
		}
		
		System.out.println(sum);
	}
}
0