結果

問題 No.289 数字を全て足そう
ユーザー mits58mits58
提出日時 2016-05-05 15:04:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 150 ms / 1,000 ms
コード長 365 bytes
コンパイル時間 2,156 ms
コンパイル使用メモリ 73,852 KB
実行使用メモリ 54,256 KB
最終ジャッジ日時 2024-04-16 21:06:21
合計ジャッジ時間 6,447 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
54,212 KB
testcase_01 AC 129 ms
54,116 KB
testcase_02 AC 131 ms
53,888 KB
testcase_03 AC 130 ms
53,808 KB
testcase_04 AC 129 ms
54,240 KB
testcase_05 AC 138 ms
54,160 KB
testcase_06 AC 136 ms
53,744 KB
testcase_07 AC 144 ms
53,856 KB
testcase_08 AC 146 ms
54,076 KB
testcase_09 AC 132 ms
53,996 KB
testcase_10 AC 145 ms
53,956 KB
testcase_11 AC 144 ms
53,932 KB
testcase_12 AC 145 ms
54,084 KB
testcase_13 AC 144 ms
53,964 KB
testcase_14 AC 144 ms
54,016 KB
testcase_15 AC 144 ms
54,136 KB
testcase_16 AC 143 ms
53,704 KB
testcase_17 AC 147 ms
53,856 KB
testcase_18 AC 150 ms
54,184 KB
testcase_19 AC 143 ms
54,256 KB
testcase_20 AC 144 ms
54,104 KB
testcase_21 AC 131 ms
54,124 KB
testcase_22 AC 146 ms
53,992 KB
testcase_23 AC 144 ms
53,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        while(sc.hasNext()){
        	String s=sc.next();
        	int res=0;
        	for(int i=0;i<s.length();i++) if(s.charAt(i)-'0'>=0 && s.charAt(i)-'0'<=9) res+=s.charAt(i)-'0';
        	System.out.println(res);
        }
    }
}
0