結果

問題 No.9009 改行区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー tsunabittsunabit
提出日時 2018-03-25 03:36:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 609 ms / 3,000 ms
コード長 867 bytes
コンパイル時間 3,397 ms
コンパイル使用メモリ 72,588 KB
実行使用メモリ 63,928 KB
最終ジャッジ日時 2023-09-07 10:59:50
合計ジャッジ時間 11,866 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,764 KB
testcase_01 AC 123 ms
55,636 KB
testcase_02 AC 122 ms
55,620 KB
testcase_03 AC 121 ms
55,928 KB
testcase_04 AC 122 ms
55,636 KB
testcase_05 AC 128 ms
55,388 KB
testcase_06 AC 163 ms
55,836 KB
testcase_07 AC 233 ms
59,924 KB
testcase_08 AC 467 ms
60,960 KB
testcase_09 AC 506 ms
61,332 KB
testcase_10 AC 580 ms
63,876 KB
testcase_11 AC 586 ms
63,928 KB
testcase_12 AC 579 ms
63,332 KB
testcase_13 AC 607 ms
63,532 KB
testcase_14 AC 609 ms
62,972 KB
testcase_15 AC 607 ms
61,596 KB
testcase_16 AC 597 ms
62,876 KB
testcase_17 AC 123 ms
55,692 KB
testcase_18 AC 125 ms
56,212 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 No9009 {
    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