結果
| 問題 | 
                            No.1336 Union on Blackboard
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-01-15 22:10:36 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 4 ms / 2,000 ms | 
| コード長 | 279 bytes | 
| コンパイル時間 | 1,443 ms | 
| コンパイル使用メモリ | 164,940 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-26 15:10:00 | 
| 合計ジャッジ時間 | 2,384 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 31 | 
ソースコード
#include<bits/stdc++.h> 
using namespace std;
const int64_t mod=1e9+7;
int main(){
  int t;
  cin>>t;
  while(t--){
    int n;
    int64_t ans=0;
    cin>>n;
    cin>>ans;
    for(int i=0,a;i<n-1;i++){
      cin>>a;
      ans=((ans+a)+ans*a)%mod;
    }
    cout<<ans<<'\n';
  }
}