結果

問題 No.9011 数字を全て足そう(数字だけ)
ユーザー shinwisteriashinwisteria
提出日時 2017-05-04 22:38:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 308 bytes
コンパイル時間 3,167 ms
コンパイル使用メモリ 73,416 KB
実行使用メモリ 56,188 KB
最終ジャッジ日時 2023-08-03 23:00:04
合計ジャッジ時間 7,100 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,328 KB
testcase_01 AC 121 ms
55,808 KB
testcase_02 AC 122 ms
55,868 KB
testcase_03 AC 121 ms
55,856 KB
testcase_04 AC 121 ms
55,352 KB
testcase_05 AC 120 ms
55,996 KB
testcase_06 AC 122 ms
55,944 KB
testcase_07 AC 122 ms
56,016 KB
testcase_08 AC 120 ms
55,776 KB
testcase_09 AC 122 ms
55,712 KB
testcase_10 AC 122 ms
55,672 KB
testcase_11 AC 120 ms
55,636 KB
testcase_12 AC 120 ms
55,876 KB
testcase_13 AC 124 ms
55,832 KB
testcase_14 AC 121 ms
55,704 KB
testcase_15 AC 122 ms
55,672 KB
testcase_16 AC 116 ms
55,512 KB
testcase_17 AC 121 ms
55,912 KB
testcase_18 AC 120 ms
56,188 KB
testcase_19 AC 120 ms
55,356 KB
testcase_20 AC 120 ms
55,692 KB
testcase_21 AC 120 ms
55,648 KB
testcase_22 AC 120 ms
55,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Allsum {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String S = s.nextLine();
		s.close();
		int sum = 0;
		for(int i = 0;i < S.length();i++){
			sum += Integer.parseInt(S.substring(i, i+1));
		}
		System.out.println(sum);

	}

}
0