結果

問題 No.1081 和の和
ユーザー xRS43BofaUEZ5gcxRS43BofaUEZ5gc
提出日時 2021-03-29 14:40:35
言語 Java
(openjdk 23)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 482 bytes
コンパイル時間 3,445 ms
コンパイル使用メモリ 74,664 KB
実行使用メモリ 41,784 KB
最終ジャッジ日時 2024-11-29 09:48:43
合計ジャッジ時間 5,738 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class HelloWorld {
		public static void main (String[] args) {
			Scanner sc = new Scanner(System.in);
			int n = sc.nextInt();
			int[] ai = new int[n];
			long sum = 0;
			for (int i = 0; i < n; i ++) {
				ai[i] = sc.nextInt();
			}
			sc.close();

			for (int i = n-1; i > 1; i --) {
				for (int j = 0; j < i;j ++) {
					ai[j] = ai[j] + ai[j+1];
					ai[j] %= 1000000007;
				}
			}

			System.out.println((ai[0] + ai[1]) % 1000000007);

	}
}
0