結果

問題 No.289 数字を全て足そう
ユーザー 🐧しゅんチャマ🌸🐧しゅんチャマ🌸
提出日時 2023-09-13 22:27:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 1,000 ms
コード長 368 bytes
コンパイル時間 1,991 ms
コンパイル使用メモリ 72,080 KB
実行使用メモリ 56,360 KB
最終ジャッジ日時 2023-09-13 22:27:11
合計ジャッジ時間 6,330 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,852 KB
testcase_01 AC 120 ms
56,092 KB
testcase_02 AC 121 ms
55,984 KB
testcase_03 AC 119 ms
55,740 KB
testcase_04 AC 120 ms
56,028 KB
testcase_05 AC 125 ms
55,832 KB
testcase_06 AC 124 ms
56,212 KB
testcase_07 AC 133 ms
55,764 KB
testcase_08 AC 135 ms
55,920 KB
testcase_09 AC 126 ms
55,940 KB
testcase_10 AC 131 ms
56,056 KB
testcase_11 AC 136 ms
56,184 KB
testcase_12 AC 137 ms
55,916 KB
testcase_13 AC 134 ms
55,860 KB
testcase_14 AC 137 ms
55,760 KB
testcase_15 AC 135 ms
55,784 KB
testcase_16 AC 133 ms
55,760 KB
testcase_17 AC 133 ms
56,360 KB
testcase_18 AC 135 ms
56,320 KB
testcase_19 AC 134 ms
56,116 KB
testcase_20 AC 134 ms
56,200 KB
testcase_21 AC 118 ms
55,760 KB
testcase_22 AC 136 ms
55,940 KB
testcase_23 AC 135 ms
55,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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