結果

問題 No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー ShotaroSuzuShotaroSuzu
提出日時 2020-05-19 17:48:38
言語 Java21
(openjdk 21)
結果
AC  
実行時間 959 ms / 2,000 ms
コード長 637 bytes
コンパイル時間 2,261 ms
コンパイル使用メモリ 75,352 KB
実行使用メモリ 75,816 KB
最終ジャッジ日時 2024-04-09 22:19:24
合計ジャッジ時間 11,511 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
54,316 KB
testcase_01 AC 116 ms
54,104 KB
testcase_02 AC 119 ms
54,168 KB
testcase_03 AC 118 ms
53,860 KB
testcase_04 AC 105 ms
52,896 KB
testcase_05 AC 129 ms
54,176 KB
testcase_06 AC 173 ms
54,452 KB
testcase_07 AC 275 ms
58,680 KB
testcase_08 AC 523 ms
61,936 KB
testcase_09 AC 506 ms
60,944 KB
testcase_10 AC 870 ms
73,504 KB
testcase_11 AC 864 ms
75,240 KB
testcase_12 AC 873 ms
75,452 KB
testcase_13 AC 829 ms
75,252 KB
testcase_14 AC 883 ms
73,240 KB
testcase_15 AC 934 ms
75,592 KB
testcase_16 AC 959 ms
75,816 KB
testcase_17 AC 117 ms
54,248 KB
testcase_18 AC 107 ms
53,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder.tutorial.sum.bywhitespace;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().execute();

	}

	private void execute() {
		List<Long> nums = read();

		long sum = 0L;

		for (Long num : nums) {
			sum += num;
		}

		System.out.println(sum);
	}

	private List<Long> read() {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		int length = sc.nextInt();

		List<Long> numsList = new ArrayList<>();
		for (int i = 0; i < length; i++) {
			numsList.add(sc.nextLong());
		}
		return numsList;
	}

}
0