結果

問題 No.289 数字を全て足そう
ユーザー d07ki3bq1uzd07ki3bq1uz
提出日時 2019-09-28 01:24:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 150 ms / 1,000 ms
コード長 385 bytes
コンパイル時間 3,057 ms
コンパイル使用メモリ 75,312 KB
実行使用メモリ 57,568 KB
最終ジャッジ日時 2023-10-25 09:31:24
合計ジャッジ時間 6,745 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
57,484 KB
testcase_01 AC 131 ms
57,468 KB
testcase_02 AC 132 ms
57,512 KB
testcase_03 AC 133 ms
57,524 KB
testcase_04 AC 132 ms
57,160 KB
testcase_05 AC 140 ms
57,484 KB
testcase_06 AC 138 ms
57,488 KB
testcase_07 AC 148 ms
57,264 KB
testcase_08 AC 146 ms
57,520 KB
testcase_09 AC 137 ms
57,488 KB
testcase_10 AC 144 ms
57,444 KB
testcase_11 AC 147 ms
57,516 KB
testcase_12 AC 149 ms
57,528 KB
testcase_13 AC 149 ms
57,504 KB
testcase_14 AC 149 ms
57,512 KB
testcase_15 AC 147 ms
57,516 KB
testcase_16 AC 148 ms
57,560 KB
testcase_17 AC 150 ms
57,568 KB
testcase_18 AC 148 ms
57,520 KB
testcase_19 AC 147 ms
57,488 KB
testcase_20 AC 147 ms
57,540 KB
testcase_21 AC 133 ms
57,492 KB
testcase_22 AC 148 ms
57,452 KB
testcase_23 AC 150 ms
57,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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