結果

問題 No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー show258
提出日時 2017-03-26 23:30:50
言語 Java
(openjdk 23)
結果
AC  
実行時間 886 ms / 2,000 ms
コード長 504 bytes
コンパイル時間 2,798 ms
コンパイル使用メモリ 75,156 KB
実行使用メモリ 69,356 KB
最終ジャッジ日時 2024-07-06 06:36:22
合計ジャッジ時間 11,808 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Sum {

  public static void main(String[] args) {

    // 標準入力から読み込む際に、Scannerオブジェクトを使う。
    Scanner sc = new Scanner(System.in);

    // int データ個数を読み込む
    int i = sc.nextInt();

    long sum = 0;

    for (int count = 0; count < i; count++){
      // long 1つ分を読み込む

      sum = sum + sc.nextLong();
    }

    // 標準出力に書き出す。
    System.out.println(sum);
  }

}
0