結果

問題 No.9009 改行区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー ShotaroSuzuShotaroSuzu
提出日時 2020-05-19 17:51:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 999 ms / 3,000 ms
コード長 634 bytes
コンパイル時間 2,274 ms
コンパイル使用メモリ 75,488 KB
実行使用メモリ 75,676 KB
最終ジャッジ日時 2024-04-09 22:19:55
合計ジャッジ時間 12,105 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
53,384 KB
testcase_01 AC 122 ms
54,108 KB
testcase_02 AC 121 ms
54,180 KB
testcase_03 AC 123 ms
54,316 KB
testcase_04 AC 122 ms
54,116 KB
testcase_05 AC 133 ms
54,028 KB
testcase_06 AC 185 ms
54,560 KB
testcase_07 AC 289 ms
58,688 KB
testcase_08 AC 516 ms
61,912 KB
testcase_09 AC 606 ms
61,680 KB
testcase_10 AC 912 ms
75,424 KB
testcase_11 AC 915 ms
75,444 KB
testcase_12 AC 929 ms
75,676 KB
testcase_13 AC 935 ms
75,416 KB
testcase_14 AC 931 ms
75,580 KB
testcase_15 AC 877 ms
75,136 KB
testcase_16 AC 999 ms
75,072 KB
testcase_17 AC 117 ms
54,256 KB
testcase_18 AC 120 ms
54,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder.tutorial.sum.bylinesep;

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