結果
問題 |
No.1681 +-*
|
ユーザー |
|
提出日時 | 2022-06-28 22:38:56 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 188 ms / 2,000 ms |
コード長 | 344 bytes |
コンパイル時間 | 553 ms |
コンパイル使用メモリ | 81,876 KB |
実行使用メモリ | 102,016 KB |
最終ジャッジ日時 | 2024-11-21 17:25:18 |
合計ジャッジ時間 | 4,502 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
import sys input = lambda: sys.stdin.readline().rstrip() mod = 10**9 + 7 # ----------------------- # n = int(input()) A = list(map(int, input().split())) ans = 0 mul = 1 for i,a in enumerate(A): mul *= a mul %= mod if i == n-1: continue ans += mul * 2 * pow(3, max(0,n-i-2), mod) ans %= mod ans += mul ans %= mod print(ans)