結果
問題 |
No.1681 +-*
|
ユーザー |
👑 ![]() |
提出日時 | 2021-09-17 21:30:43 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 489 bytes |
コンパイル時間 | 2,751 ms |
コンパイル使用メモリ | 245,244 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-29 19:53:52 |
合計ジャッジ時間 | 4,041 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/modint> using namespace std; using Modint = atcoder::modint1000000007; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int N; cin >> N; Modint ans = 0, c = Modint::raw(1); for(int i = 0; ; i++){ int a; cin >> a; ans *= 3; c *= Modint::raw(a); if(i == N - 1) break; ans += c; } ans *= Modint::raw(666666672); ans += c; cout << ans.val() << endl; }