結果

問題 No.1081 和の和
ユーザー ks2m
提出日時 2020-06-19 21:24:28
言語 Java
(openjdk 23)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 484 bytes
コンパイル時間 2,634 ms
コンパイル使用メモリ 74,136 KB
実行使用メモリ 54,288 KB
最終ジャッジ日時 2024-07-03 13:40:35
合計ジャッジ時間 4,438 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextLong();
		}
		sc.close();

		for (int i = n - 1; i > 0; i--) {
			long[] b = new long[n];
			for (int j = 0; j < i; j++) {
				b[j] = a[j] + a[j + 1];
				b[j] %= 1000000007;
			}
			a = b;
		}
		System.out.println(a[0] % 1000000007);
	}
}
0