結果

問題 No.289 数字を全て足そう
ユーザー hippolover02hippolover02
提出日時 2022-08-29 17:11:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 1,000 ms
コード長 431 bytes
コンパイル時間 2,215 ms
コンパイル使用メモリ 74,956 KB
実行使用メモリ 41,752 KB
最終ジャッジ日時 2024-04-24 07:04:29
合計ジャッジ時間 5,449 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
40,404 KB
testcase_01 AC 96 ms
40,180 KB
testcase_02 AC 97 ms
40,168 KB
testcase_03 AC 106 ms
41,060 KB
testcase_04 AC 112 ms
41,208 KB
testcase_05 AC 115 ms
41,004 KB
testcase_06 AC 106 ms
40,812 KB
testcase_07 AC 125 ms
41,332 KB
testcase_08 AC 134 ms
40,896 KB
testcase_09 AC 111 ms
41,360 KB
testcase_10 AC 117 ms
41,428 KB
testcase_11 AC 119 ms
41,512 KB
testcase_12 AC 137 ms
41,388 KB
testcase_13 AC 123 ms
41,308 KB
testcase_14 AC 127 ms
40,996 KB
testcase_15 AC 121 ms
41,144 KB
testcase_16 AC 121 ms
40,928 KB
testcase_17 AC 123 ms
41,752 KB
testcase_18 AC 123 ms
40,920 KB
testcase_19 AC 124 ms
41,444 KB
testcase_20 AC 122 ms
41,248 KB
testcase_21 AC 108 ms
41,224 KB
testcase_22 AC 137 ms
41,712 KB
testcase_23 AC 128 ms
40,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        int total = 0;
        for (int i = 0; i<line.length(); i++){
            char c = line.charAt(i);
            if(48 <= c && c <= 57){
                total += Character.getNumericValue(c);
            }
        }
        System.out.println(total);
    }
}
0