結果

問題 No.9011 数字を全て足そう(数字だけ)
ユーザー きつねうどんきつねうどん
提出日時 2024-03-13 19:31:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 342 bytes
コンパイル時間 2,882 ms
コンパイル使用メモリ 74,324 KB
実行使用メモリ 58,192 KB
最終ジャッジ日時 2024-03-13 19:31:55
合計ジャッジ時間 6,824 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
57,708 KB
testcase_01 AC 127 ms
57,828 KB
testcase_02 AC 124 ms
57,532 KB
testcase_03 AC 124 ms
57,716 KB
testcase_04 AC 142 ms
57,696 KB
testcase_05 AC 138 ms
57,528 KB
testcase_06 AC 129 ms
57,852 KB
testcase_07 AC 130 ms
57,540 KB
testcase_08 AC 128 ms
57,548 KB
testcase_09 AC 125 ms
57,836 KB
testcase_10 AC 131 ms
57,844 KB
testcase_11 AC 128 ms
57,576 KB
testcase_12 AC 129 ms
57,828 KB
testcase_13 AC 141 ms
57,680 KB
testcase_14 AC 125 ms
57,720 KB
testcase_15 AC 136 ms
57,552 KB
testcase_16 AC 127 ms
57,728 KB
testcase_17 AC 124 ms
55,636 KB
testcase_18 AC 126 ms
58,192 KB
testcase_19 AC 128 ms
58,064 KB
testcase_20 AC 132 ms
57,568 KB
testcase_21 AC 141 ms
57,704 KB
testcase_22 AC 130 ms
55,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    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++) {
            sum += Integer.parseInt(S.substring(i, i + 1));
        }
        System.out.println(sum);
    }
}

0