結果

問題 No.289 数字を全て足そう
ユーザー brave_reverse_brave_reverse_
提出日時 2016-01-08 00:27:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 153 ms / 1,000 ms
コード長 390 bytes
コンパイル時間 3,508 ms
コンパイル使用メモリ 74,448 KB
実行使用メモリ 41,924 KB
最終ジャッジ日時 2024-04-16 21:00:17
合計ジャッジ時間 7,838 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
41,556 KB
testcase_01 AC 129 ms
41,440 KB
testcase_02 AC 129 ms
41,484 KB
testcase_03 AC 130 ms
41,652 KB
testcase_04 AC 130 ms
41,128 KB
testcase_05 AC 140 ms
41,520 KB
testcase_06 AC 136 ms
41,924 KB
testcase_07 AC 146 ms
41,416 KB
testcase_08 AC 153 ms
41,820 KB
testcase_09 AC 134 ms
41,124 KB
testcase_10 AC 153 ms
41,412 KB
testcase_11 AC 145 ms
41,716 KB
testcase_12 AC 151 ms
41,432 KB
testcase_13 AC 143 ms
41,524 KB
testcase_14 AC 148 ms
41,796 KB
testcase_15 AC 149 ms
41,524 KB
testcase_16 AC 145 ms
41,524 KB
testcase_17 AC 149 ms
41,520 KB
testcase_18 AC 147 ms
41,452 KB
testcase_19 AC 153 ms
41,796 KB
testcase_20 AC 146 ms
41,592 KB
testcase_21 AC 129 ms
41,180 KB
testcase_22 AC 150 ms
41,152 KB
testcase_23 AC 150 ms
41,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicorder;
import java.util.Scanner;

public class QNo279 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int num =0;
		char[] charas = s.toCharArray();
		for(int i=0;i<charas.length;i++){
			if(Character.isDigit(charas[i])){
				num += Character.getNumericValue(charas[i]);
			}
		}
		
		System.out.println(num);
	}

}
0