結果
| 問題 |
No.1681 +-*
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-15 22:07:06 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 475 bytes |
| コンパイル時間 | 6,392 ms |
| コンパイル使用メモリ | 193,584 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-04-15 22:08:48 |
| 合計ジャッジ時間 | 9,618 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 6 RE * 12 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | scanf("%d", &a);
| ~~~~~^~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+10, Mod = 1e9+7;
long long pre[N], _pow[N];
int main()
{
int n;
cin >> n;
_pow[0] = 1, pre[0] = 1;
for(int i = 1; i <= n; i ++)
{
int a;
scanf("%d", &a);
pre[i] = pre[i - 1] * a % Mod;
_pow[i] = _pow[i - 1] * 3 % Mod;
}
long long res = 0;
for(int k = 1; k < n; k++)
{
res = (res + (pre[k] * 2 * _pow[n - k - 1]) % Mod) % Mod;
}
res = (res + pre[n] % Mod) % Mod;
cout << res;
}