結果

問題 No.9011 数字を全て足そう(数字だけ)
ユーザー 鹿鹿
提出日時 2021-04-07 21:52:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 501 bytes
コンパイル時間 5,080 ms
コンパイル使用メモリ 72,184 KB
実行使用メモリ 49,824 KB
最終ジャッジ日時 2023-09-05 05:35:32
合計ジャッジ時間 6,716 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,416 KB
testcase_01 AC 44 ms
49,336 KB
testcase_02 AC 43 ms
49,576 KB
testcase_03 AC 44 ms
49,244 KB
testcase_04 AC 44 ms
49,692 KB
testcase_05 AC 44 ms
49,316 KB
testcase_06 AC 44 ms
49,540 KB
testcase_07 AC 45 ms
49,572 KB
testcase_08 AC 44 ms
49,368 KB
testcase_09 AC 44 ms
49,428 KB
testcase_10 AC 46 ms
49,412 KB
testcase_11 AC 45 ms
49,424 KB
testcase_12 AC 44 ms
49,572 KB
testcase_13 AC 46 ms
49,316 KB
testcase_14 AC 45 ms
49,404 KB
testcase_15 AC 45 ms
49,428 KB
testcase_16 AC 45 ms
49,348 KB
testcase_17 AC 45 ms
49,360 KB
testcase_18 AC 44 ms
49,324 KB
testcase_19 AC 45 ms
49,824 KB
testcase_20 AC 45 ms
49,316 KB
testcase_21 AC 46 ms
49,432 KB
testcase_22 AC 44 ms
49,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;

public class Sum {
	public static void main (String[] args) throws IOException{
		try (BufferedReader in = new BufferedReader(new InputStreamReader(System.in))){
			
			String numString = new String(in.readLine());
			in.close();
			
			String[] array = numString.split("");
			 int sum = 0;
			 
			 for (int i = 0; i < numString.length(); i++){
			 	sum += Integer.parseInt(array[i]);
			 }
			 
			 System.out.println(sum);
			
		} catch (IOException e){
			// 例外
		}
	}
}			
0