結果

問題 No.289 数字を全て足そう
ユーザー shinwisteria
提出日時 2017-03-18 19:08:26
言語 Java
(openjdk 23)
結果
AC  
実行時間 167 ms / 1,000 ms
コード長 342 bytes
コンパイル時間 4,140 ms
コンパイル使用メモリ 74,600 KB
実行使用メモリ 41,984 KB
最終ジャッジ日時 2024-07-04 19:19:36
合計ジャッジ時間 7,445 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Tas {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		char[] c = s.nextLine().toCharArray();
		s.close();
		int total = 0;
		
		for(char c2 : c){
			if(Character.isDigit(c2)){
				total += Character.getNumericValue(c2);
			}
		}
		
		System.out.println(total);

	}

}
0