結果
問題 | No.9001 標準入出力の練習問題(テスト用) |
ユーザー | mochi8k |
提出日時 | 2016-03-20 02:34:53 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 138 ms / 1,000 ms |
コード長 | 564 bytes |
コンパイル時間 | 2,333 ms |
コンパイル使用メモリ | 77,344 KB |
実行使用メモリ | 57,948 KB |
最終ジャッジ日時 | 2024-04-08 17:14:12 |
合計ジャッジ時間 | 3,099 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 138 ms
57,848 KB |
testcase_01 | AC | 134 ms
57,948 KB |
ソースコード
import java.util.ArrayList; import java.util.Scanner; public class Main { static int sum(ArrayList<Integer> list) { int sum = 0; for (int number: list) { sum += number; } return sum; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); ArrayList<Integer> numbers = new ArrayList<Integer>(); while (sc.hasNextInt()) { numbers.add(sc.nextInt()); } System.out.print(sum(numbers)); if (sc.hasNext()) { System.out.print(" " + sc.next()); } } }