結果

問題 No.1081 和の和
ユーザー ks2mks2m
提出日時 2020-06-19 21:24:28
言語 Java19
(openjdk 21)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 484 bytes
コンパイル時間 2,003 ms
コンパイル使用メモリ 71,804 KB
実行使用メモリ 57,932 KB
最終ジャッジ日時 2023-09-16 13:10:17
合計ジャッジ時間 4,359 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
56,008 KB
testcase_01 AC 126 ms
57,932 KB
testcase_02 AC 124 ms
56,048 KB
testcase_03 AC 130 ms
56,128 KB
testcase_04 AC 137 ms
55,884 KB
testcase_05 AC 125 ms
55,640 KB
testcase_06 AC 130 ms
57,924 KB
testcase_07 AC 135 ms
56,056 KB
testcase_08 AC 136 ms
55,448 KB
testcase_09 AC 135 ms
55,936 KB
testcase_10 AC 135 ms
55,704 KB
権限があれば一括ダウンロードができます

ソースコード

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