結果

問題 No.289 数字を全て足そう
ユーザー kamonegi2236
提出日時 2015-11-14 13:00:16
言語 Java
(openjdk 23)
結果
AC  
実行時間 232 ms / 1,000 ms
コード長 560 bytes
コンパイル時間 3,284 ms
コンパイル使用メモリ 75,300 KB
実行使用メモリ 46,832 KB
最終ジャッジ日時 2024-10-07 20:33:19
合計ジャッジ時間 8,863 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.Arrays;
import java.util.List;
public class No289 {

	public static void main(String[] args) {
		
		int count=0;
		
		Scanner in = new Scanner(System.in);
        String str = in.next();
        List<String> list = Arrays.asList(str.split(""));
        for(String q :list){
        	count += toInt(q);
        }
		in.close();
        System.out.println(count); 
	}
	
	public static int toInt(String str){
		int ans = 0;
		
		try{
			ans = Integer.parseInt(str);
		}
		catch(Exception ex){
			
		}
		return ans;
	}

}
0