結果

問題 No.1081 和の和
ユーザー tentententen
提出日時 2020-08-19 11:15:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 544 bytes
コンパイル時間 2,438 ms
コンパイル使用メモリ 73,864 KB
実行使用メモリ 54,524 KB
最終ジャッジ日時 2024-04-20 08:15:26
合計ジャッジ時間 4,246 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
54,524 KB
testcase_01 AC 113 ms
54,200 KB
testcase_02 AC 131 ms
52,960 KB
testcase_03 AC 119 ms
54,312 KB
testcase_04 AC 123 ms
53,476 KB
testcase_05 AC 124 ms
54,072 KB
testcase_06 AC 108 ms
53,280 KB
testcase_07 AC 122 ms
53,880 KB
testcase_08 AC 125 ms
54,176 KB
testcase_09 AC 127 ms
53,968 KB
testcase_10 AC 128 ms
54,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    static final int MOD = 1000000007;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        for (int i = 0; i < n - 1; i++) {
            for (int j = 0; j < n - 1 - i; j++) {
                arr[j] += arr[j + 1];
                arr[j] %= MOD;
            }
        }
        System.out.println(arr[0]);
    }
} 
0