結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
54,092 KB
testcase_01 AC 118 ms
54,096 KB
testcase_02 AC 126 ms
54,356 KB
testcase_03 AC 122 ms
53,988 KB
testcase_04 AC 109 ms
53,200 KB
testcase_05 AC 130 ms
54,256 KB
testcase_06 AC 178 ms
54,948 KB
testcase_07 AC 272 ms
58,636 KB
testcase_08 AC 519 ms
61,680 KB
testcase_09 AC 595 ms
61,900 KB
testcase_10 AC 878 ms
75,392 KB
testcase_11 AC 890 ms
75,180 KB
testcase_12 AC 896 ms
75,768 KB
testcase_13 AC 904 ms
75,572 KB
testcase_14 AC 846 ms
75,444 KB
testcase_15 AC 960 ms
75,652 KB
testcase_16 AC 927 ms
75,356 KB
testcase_17 AC 120 ms
54,180 KB
testcase_18 AC 123 ms
54,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder.tutorial.sum.bywhitespace;

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

public class Main {

	private static final String SEPARATOR = " ";

	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() {
		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