結果
問題 | No.1336 Union on Blackboard |
ユーザー |
![]() |
提出日時 | 2021-01-30 00:32:41 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 973 bytes |
コンパイル時間 | 3,236 ms |
コンパイル使用メモリ | 139,680 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-27 10:41:43 |
合計ジャッジ時間 | 2,351 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 31 |
ソースコード
#include <iostream>#include <string>#include <vector>#include <map>#include <set>#include <utility>#include <algorithm>#include <cmath>#include <climits>#include <iomanip>#include <queue>#include <stack>#include <ctype.h>using namespace std;typedef long long ll;const int INF = (1<<30)-1;const ll LINF = 1e18;#define rep(i, n) for (int i = 0; i < n; i++)template<class T>bool chmax(T &a, T b) {if (a < b) {a = b;return true;}else return false;}template<class T>bool chmin(T &a, T b) {if (a > b) {a = b;return true;}else return false;}int main() {int t; cin >> t;ll mod = 1e9+7;while (t--) {int n; cin >> n;vector<ll> a(n);rep(i, n) cin >> a[i];ll res = a[0];rep(i, n-1) {res = res + a[i+1] + res * a[i+1];res %= mod;}cout << res << endl;}return 0;}//小数点精度//cout << fixed << std::setprecision(15) << y << endl;