結果
問題 | No.1336 Union on Blackboard |
ユーザー |
![]() |
提出日時 | 2021-01-15 22:18:57 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 432 bytes |
コンパイル時間 | 1,903 ms |
コンパイル使用メモリ | 195,344 KB |
最終ジャッジ日時 | 2025-01-17 19:38:47 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 31 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)#define ALL(v) v.begin(),v.end()typedef long long ll;#include <bits/stdc++.h>using namespace std;const ll MOD=1e9+7;int main(){int t;cin>>t;while(t--){int n;cin>>n;vector<ll> A(n);rep(i,n) cin>>A[i];ll ans=A[0]+A[1]+A[0]*A[1];for(int i=2;i<n;i++){ans=(ans+A[i]+ans*A[i]%MOD)%MOD;}cout<<ans<<endl;}return 0;}