結果

問題 No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー tsunabittsunabit
提出日時 2018-03-25 03:34:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 597 ms / 2,000 ms
コード長 867 bytes
コンパイル時間 3,240 ms
コンパイル使用メモリ 73,108 KB
実行使用メモリ 63,868 KB
最終ジャッジ日時 2023-09-07 10:58:54
合計ジャッジ時間 10,892 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,948 KB
testcase_01 AC 124 ms
55,452 KB
testcase_02 AC 122 ms
55,680 KB
testcase_03 AC 128 ms
55,744 KB
testcase_04 AC 131 ms
55,324 KB
testcase_05 AC 129 ms
55,848 KB
testcase_06 AC 174 ms
56,340 KB
testcase_07 AC 236 ms
59,940 KB
testcase_08 AC 434 ms
61,264 KB
testcase_09 AC 395 ms
60,944 KB
testcase_10 AC 562 ms
63,516 KB
testcase_11 AC 571 ms
62,804 KB
testcase_12 AC 588 ms
63,584 KB
testcase_13 AC 576 ms
63,152 KB
testcase_14 AC 589 ms
63,708 KB
testcase_15 AC 587 ms
63,868 KB
testcase_16 AC 597 ms
63,216 KB
testcase_17 AC 120 ms
55,772 KB
testcase_18 AC 123 ms
55,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

// 問題文
// N個の数値データが入力されるのでそれらの値の合計を求めてください。
// ただし、intなどの32ビット整数型では収まらないので注意してください。
// 入力
// 1行目にデータの個数N。
// 2行目に半角スペース区切りのN個の数値データ。
// 2≤N≤500000
// 0≤Ai<263 (1≤i≤N)
// 0≤∑1≤i≤NAi=A1+A2+…+AN<263
public class No9008 {
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner sc = new Scanner(System.in);
        long n = sc.nextInt();
        long t = 0L;
        for(int i = 0 ; i < n ; i++){
            //Stringをlongへ変換する
            t += Long.parseLong(sc.next());
        }
        System.out.println(t);
    }
}
0