結果

問題 No.1681 +-*
ユーザー otoshigootoshigo
提出日時 2021-09-17 21:48:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 994 bytes
コンパイル時間 5,458 ms
コンパイル使用メモリ 260,516 KB
実行使用メモリ 4,780 KB
最終ジャッジ日時 2023-09-12 07:14:48
合計ジャッジ時間 6,589 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 58 ms
4,756 KB
testcase_06 AC 58 ms
4,692 KB
testcase_07 AC 58 ms
4,776 KB
testcase_08 AC 96 ms
4,780 KB
testcase_09 AC 96 ms
4,652 KB
testcase_10 AC 96 ms
4,652 KB
testcase_11 AC 97 ms
4,656 KB
testcase_12 AC 97 ms
4,656 KB
testcase_13 AC 47 ms
4,380 KB
testcase_14 AC 94 ms
4,656 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 95 ms
4,660 KB
testcase_18 AC 95 ms
4,604 KB
testcase_19 AC 97 ms
4,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using mint = modint1000000007;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;  using vvi = vector<vi>;
using vl = vector<ll>;   using vvl = vector<vl>;
using vb = vector<bool>; using vvb = vector<vb>;
using vm = vector<mint>; using vvm = vector<vm>;
using vpi = vector<pii>; using vvpi = vector<vpi>;
using vpl = vector<pll>; using vvpl = vector<vpl>;
const int inf = 1 << 30;
const ll INF = 1LL << 60;
#define rep(i,m,n) for (int i = m; i < (int)(n); i++)
#define rrep(i,m,n) for (int i = m; i > (int)(n); i--)

int main(){
    int n; cin >> n;
    vl A(n);
    rep(i,0,n){
        cin >> A[i];
    }
    mint ju = 1, ans = 0;
    rep(i,0,n){
        ju *= A[i];
        if (n-2-i >= 0) ans += ju*2*mint(3).pow(n-2-i);
        else ans += ju;
    }
    cout << ans.val() << endl;
}
0