結果
問題 | No.1336 Union on Blackboard |
ユーザー |
|
提出日時 | 2021-01-17 17:27:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 764 bytes |
コンパイル時間 | 1,342 ms |
コンパイル使用メモリ | 166,012 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-29 21:32:07 |
合計ジャッジ時間 | 2,294 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 31 |
ソースコード
#include<bits/stdc++.h> // #include<atcoder/all> using namespace std; // using namespace atcoder; using lint = long long; #define endl '\n' lint const mod = 1e9+7; //long const mod = 998244353; lint inv_mod(lint x, lint p){ lint ans = 1; lint tmp = x; for(lint i=1;i<=(p-2);i *= 2){ if(i & (p-2)){ ans *= tmp; } ans %= p; tmp = tmp*tmp; tmp %= p; } return ans; } void solve(){ int n; cin >> n; int a[n]; lint ans = 1; for(int i=0;i<n;i++){ cin >> a[i]; ans *= (a[i]+1); ans %= mod; } ans--; if(ans < 0)ans+=mod; cout << ans << endl; } int main(){ int t; cin >> t; for(int i=0;i<t;i++){ solve(); } }