結果

問題 No.1081 和の和
ユーザー xRS43BofaUEZ5gcxRS43BofaUEZ5gc
提出日時 2021-03-29 14:40:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 482 bytes
コンパイル時間 3,388 ms
コンパイル使用メモリ 73,988 KB
実行使用メモリ 41,524 KB
最終ジャッジ日時 2024-05-06 23:11:23
合計ジャッジ時間 5,144 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
41,268 KB
testcase_01 AC 115 ms
41,376 KB
testcase_02 AC 118 ms
40,948 KB
testcase_03 AC 117 ms
40,992 KB
testcase_04 AC 130 ms
41,492 KB
testcase_05 AC 124 ms
41,464 KB
testcase_06 AC 128 ms
41,192 KB
testcase_07 AC 130 ms
41,396 KB
testcase_08 AC 129 ms
41,524 KB
testcase_09 AC 128 ms
41,492 KB
testcase_10 AC 132 ms
41,388 KB
権限があれば一括ダウンロードができます

ソースコード

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