結果
| 問題 |
No.9009 改行区切りで与えられる数値データの合計値を求める(テスト用)
|
| ユーザー |
|
| 提出日時 | 2020-05-19 17:51:19 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 898 ms / 3,000 ms |
| コード長 | 634 bytes |
| コンパイル時間 | 1,923 ms |
| コンパイル使用メモリ | 75,404 KB |
| 実行使用メモリ | 64,268 KB |
| 最終ジャッジ日時 | 2024-10-01 22:54:42 |
| 合計ジャッジ時間 | 11,890 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 |
ソースコード
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;
}
}