結果
問題 | No.1681 +-* |
ユーザー |
![]() |
提出日時 | 2021-09-17 21:33:28 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 179 ms / 2,000 ms |
コード長 | 266 bytes |
コンパイル時間 | 203 ms |
コンパイル使用メモリ | 81,708 KB |
実行使用メモリ | 100,744 KB |
最終ジャッジ日時 | 2024-06-29 19:56:57 |
合計ジャッジ時間 | 3,539 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
import sys input = sys.stdin.readline N = int(input()) a = list(map(int, input().split())) mod = 10 ** 9 + 7 res = 0 cs = 1 for i in range(N): x = a[i] cs *= x cs %= mod res += cs * (2 * pow(3, max(0, N - i - 2), mod)) ** (i < N - 1) res %= mod print(res)