結果

問題 No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー oyafusooyafuso
提出日時 2019-03-11 10:40:38
言語 Java21
(openjdk 21)
結果
AC  
実行時間 530 ms / 2,000 ms
コード長 785 bytes
コンパイル時間 2,069 ms
コンパイル使用メモリ 72,320 KB
実行使用メモリ 101,008 KB
最終ジャッジ日時 2023-09-05 20:02:45
合計ジャッジ時間 9,014 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,464 KB
testcase_01 AC 121 ms
55,900 KB
testcase_02 AC 121 ms
55,704 KB
testcase_03 AC 121 ms
55,680 KB
testcase_04 AC 121 ms
56,264 KB
testcase_05 AC 133 ms
56,040 KB
testcase_06 AC 185 ms
56,488 KB
testcase_07 AC 267 ms
59,068 KB
testcase_08 AC 401 ms
66,424 KB
testcase_09 AC 378 ms
66,080 KB
testcase_10 AC 505 ms
84,788 KB
testcase_11 AC 508 ms
84,284 KB
testcase_12 AC 507 ms
71,512 KB
testcase_13 AC 512 ms
83,684 KB
testcase_14 AC 506 ms
86,568 KB
testcase_15 AC 514 ms
88,384 KB
testcase_16 AC 530 ms
101,008 KB
testcase_17 AC 123 ms
55,872 KB
testcase_18 AC 121 ms
55,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {

	private static final String SPLIT_STR = " ";

	public static void main(String[] args) {
		// Scanner生成
		Scanner sc = new Scanner(System.in);
		// 入力設定
		String input = sc.nextLine();
		int listSize = Integer.parseInt(input);
		List<Long> numList = new ArrayList<>(listSize);
		sc.reset();
		input = sc.nextLine();
		String[] split = input.split(SPLIT_STR);
		for (int i = 0; i < split.length; i++) {
			numList.add(Long.parseLong(split[i]));
		}
		// Scannerクローズ
		sc.close();

		/* メイン処理開始 */
		// 変数初期化
		long result = 0;
		// 結果設定
		for (int i = 0; i < numList.size(); i++) {
			result += numList.get(i);
		}
		/* メイン処理終了 */

		// 結果出力
		System.out.println(result);
	}
}
0