結果

問題 No.289 数字を全て足そう
ユーザー hippolover02
提出日時 2022-08-29 17:11:00
言語 Java
(openjdk 23)
結果
AC  
実行時間 163 ms / 1,000 ms
コード長 431 bytes
コンパイル時間 3,048 ms
コンパイル使用メモリ 74,384 KB
実行使用メモリ 42,792 KB
最終ジャッジ日時 2024-11-06 14:15:43
合計ジャッジ時間 6,374 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

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