結果

問題 No.1681 +-*
ユーザー Mik10Mik10
提出日時 2021-10-07 23:30:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 215 ms / 2,000 ms
コード長 263 bytes
コンパイル時間 1,051 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 105,660 KB
最終ジャッジ日時 2023-09-30 09:07:10
合計ジャッジ時間 5,288 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,212 KB
testcase_01 AC 75 ms
71,256 KB
testcase_02 AC 75 ms
71,372 KB
testcase_03 AC 75 ms
71,004 KB
testcase_04 AC 76 ms
71,404 KB
testcase_05 AC 113 ms
104,768 KB
testcase_06 AC 112 ms
104,792 KB
testcase_07 AC 116 ms
105,660 KB
testcase_08 AC 215 ms
100,500 KB
testcase_09 AC 214 ms
100,548 KB
testcase_10 AC 214 ms
100,424 KB
testcase_11 AC 215 ms
100,340 KB
testcase_12 AC 215 ms
100,268 KB
testcase_13 AC 97 ms
90,612 KB
testcase_14 AC 129 ms
100,340 KB
testcase_15 AC 75 ms
71,128 KB
testcase_16 AC 74 ms
71,084 KB
testcase_17 AC 177 ms
100,428 KB
testcase_18 AC 166 ms
100,228 KB
testcase_19 AC 214 ms
100,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
seql = list(map(int, input().split()))
n -= 2
ans = 0
z = 10**9+7
for i in range(n+1):
    p = seql[i]
    if not p:
        break
    seql[i+1] = seql[i+1]*p%z
    ans = (ans+pow(3, n, z)*2*p)%z
    n -= 1
else:
    ans += seql[-1]
print (ans%z)
0