結果

問題 No.1336 Union on Blackboard
ユーザー ks2mks2m
提出日時 2021-01-15 21:35:28
言語 Java21
(openjdk 21)
結果
AC  
実行時間 260 ms / 2,000 ms
コード長 499 bytes
コンパイル時間 2,303 ms
コンパイル使用メモリ 72,160 KB
実行使用メモリ 60,328 KB
最終ジャッジ日時 2023-08-17 16:19:19
合計ジャッジ時間 10,948 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,200 KB
testcase_01 AC 212 ms
58,912 KB
testcase_02 AC 225 ms
59,072 KB
testcase_03 AC 227 ms
59,172 KB
testcase_04 AC 212 ms
59,328 KB
testcase_05 AC 222 ms
59,440 KB
testcase_06 AC 231 ms
59,316 KB
testcase_07 AC 212 ms
57,660 KB
testcase_08 AC 223 ms
59,056 KB
testcase_09 AC 231 ms
59,800 KB
testcase_10 AC 251 ms
59,716 KB
testcase_11 AC 249 ms
60,008 KB
testcase_12 AC 246 ms
59,872 KB
testcase_13 AC 249 ms
60,008 KB
testcase_14 AC 258 ms
59,896 KB
testcase_15 AC 251 ms
60,136 KB
testcase_16 AC 258 ms
60,328 KB
testcase_17 AC 245 ms
59,604 KB
testcase_18 AC 250 ms
59,948 KB
testcase_19 AC 246 ms
57,864 KB
testcase_20 AC 249 ms
59,748 KB
testcase_21 AC 250 ms
60,132 KB
testcase_22 AC 251 ms
60,128 KB
testcase_23 AC 260 ms
59,676 KB
testcase_24 AC 251 ms
59,652 KB
testcase_25 AC 248 ms
59,672 KB
testcase_26 AC 258 ms
60,044 KB
testcase_27 AC 251 ms
59,960 KB
testcase_28 AC 247 ms
59,628 KB
testcase_29 AC 248 ms
59,688 KB
testcase_30 AC 130 ms
55,904 KB
testcase_31 AC 138 ms
55,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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

			long ans = a[0];
			for (int j = 1; j < n; j++) {
				ans = ans + a[j] + ans * a[j];
				ans %= mod;
			}
			System.out.println(ans);
		}
		sc.close();
	}
}
0