結果
問題 | No.1681 +-* |
ユーザー |
|
提出日時 | 2021-09-17 22:25:16 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 308 ms / 2,000 ms |
コード長 | 366 bytes |
コンパイル時間 | 166 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 33,388 KB |
最終ジャッジ日時 | 2024-06-29 21:04:07 |
合計ジャッジ時間 | 5,016 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
n = int(input()) a = list(map(int,input().split())) e = 1000000007 alist = [] three = [] temp = 1 th = 1 for i in range(n): #temp = temp*a[i] #alist.append(temp) three.append(th) th = th*3%e #print(three) ans = 0 for j in range(n-1): temp = temp*a[j]%e ans += (temp*2*three[n-2-j])%e temp = temp*(a[n-1]%e)%e ans = (ans+temp)%e print(ans)