結果

問題 No.289 数字を全て足そう
ユーザー papipenpapipen
提出日時 2017-03-24 22:00:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 144 ms / 1,000 ms
コード長 372 bytes
コンパイル時間 2,045 ms
コンパイル使用メモリ 72,248 KB
実行使用メモリ 56,032 KB
最終ジャッジ日時 2023-09-20 06:08:22
合計ジャッジ時間 6,868 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,588 KB
testcase_01 AC 122 ms
55,620 KB
testcase_02 AC 120 ms
55,676 KB
testcase_03 AC 121 ms
55,628 KB
testcase_04 AC 123 ms
55,768 KB
testcase_05 AC 130 ms
55,812 KB
testcase_06 AC 127 ms
55,908 KB
testcase_07 AC 138 ms
55,652 KB
testcase_08 AC 137 ms
55,724 KB
testcase_09 AC 124 ms
55,840 KB
testcase_10 AC 137 ms
53,644 KB
testcase_11 AC 141 ms
55,884 KB
testcase_12 AC 139 ms
55,740 KB
testcase_13 AC 138 ms
55,624 KB
testcase_14 AC 139 ms
55,620 KB
testcase_15 AC 139 ms
55,700 KB
testcase_16 AC 137 ms
55,568 KB
testcase_17 AC 137 ms
55,936 KB
testcase_18 AC 144 ms
55,748 KB
testcase_19 AC 138 ms
56,032 KB
testcase_20 AC 137 ms
55,760 KB
testcase_21 AC 119 ms
55,576 KB
testcase_22 AC 138 ms
55,600 KB
testcase_23 AC 139 ms
55,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
class Suzi{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    char ch[] = a.toCharArray();
    int sum = 0;
    for(int i = 0; i < a.length(); i++){
      if(Character.isDigit(ch[i])){
        sum += Character.getNumericValue(ch[i]);
      }
    }
    System.out.println(sum);
  }
}
0