結果
| 問題 | 
                            No.1336 Union on Blackboard
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ks2m
                         | 
                    
| 提出日時 | 2021-01-15 21:35:28 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 243 ms / 2,000 ms | 
| コード長 | 499 bytes | 
| コンパイル時間 | 1,934 ms | 
| コンパイル使用メモリ | 73,924 KB | 
| 実行使用メモリ | 46,816 KB | 
| 最終ジャッジ日時 | 2024-11-26 13:32:38 | 
| 合計ジャッジ時間 | 9,888 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 31 | 
ソースコード
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();
	}
}
            
            
            
        
            
ks2m