結果

問題 No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー ShotaroSuzu
提出日時 2020-05-19 17:48:38
言語 Java
(openjdk 26.0.2.1 + ACL)
コンパイル:
javac -J-Duser.language=en -encoding UTF8 -cp /opt/aclib/ac_library.jar _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true -cp .:/opt/aclib/ac_library.jar _class_
結果
AC  
実行時間 719 ms / 2,000 ms
+ 761µs
コード長 637 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,503 ms
コンパイル使用メモリ 87,640 KB
実行使用メモリ 64,200 KB
最終ジャッジ日時 2026-09-08 08:23:29
合計ジャッジ時間 9,791 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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