結果

問題 No.1681 +-*
ユーザー Yuta NoharaYuta Nohara
提出日時 2021-09-17 23:32:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 431 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 265,692 KB
最終ジャッジ日時 2023-09-12 09:38:08
合計ジャッジ時間 5,866 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
79,864 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect,collections,itertools,math,functools,heapq
import sys
sys.setrecursionlimit(10**6)
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def I(): return int(sys.stdin.readline().rstrip())

N=I()
A=LI()
ans = 1
mod = 10**9+7
n = 0
sums = 0
for i in range(N):
  ans *= A[i]
  ans %= mod

  if i>=2:
    if n==0:
      n = A[0]
    n *= A[i-1]

ans += n * (N-1)
ans += 3**(N-1) - N
ans %= mod
print(ans)
0