結果

問題 No.995 タピオカオイシクナーレ
ユーザー kurimupykurimupy
提出日時 2020-06-13 01:19:58
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 222 ms / 2,000 ms
コード長 426 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 86,916 KB
実行使用メモリ 78,496 KB
最終ジャッジ日時 2023-09-06 11:37:51
合計ジャッジ時間 4,890 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,544 KB
testcase_01 AC 72 ms
71,500 KB
testcase_02 AC 72 ms
71,208 KB
testcase_03 AC 71 ms
71,216 KB
testcase_04 AC 73 ms
71,204 KB
testcase_05 AC 73 ms
71,076 KB
testcase_06 AC 71 ms
71,132 KB
testcase_07 AC 73 ms
71,048 KB
testcase_08 AC 73 ms
71,396 KB
testcase_09 AC 72 ms
71,284 KB
testcase_10 AC 74 ms
70,904 KB
testcase_11 AC 80 ms
71,328 KB
testcase_12 AC 79 ms
71,172 KB
testcase_13 AC 80 ms
71,176 KB
testcase_14 AC 76 ms
71,172 KB
testcase_15 AC 78 ms
71,172 KB
testcase_16 AC 194 ms
78,452 KB
testcase_17 AC 222 ms
78,336 KB
testcase_18 AC 213 ms
78,460 KB
testcase_19 AC 198 ms
78,356 KB
testcase_20 AC 199 ms
78,048 KB
testcase_21 AC 208 ms
78,372 KB
testcase_22 AC 207 ms
78,328 KB
testcase_23 AC 209 ms
78,380 KB
testcase_24 AC 209 ms
78,140 KB
testcase_25 AC 182 ms
78,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# タピオカ美味しくなーる
N, M, K, P, Q = map(int, input().split())
value = [int(input()) for i in range(N)]
mod = 10**9 + 7


def rev(X):
    return pow(X, mod-2, mod)


up = 0
down = 2*pow(Q, K, mod)
for i in range(N):
    if i < M:
        up += value[i]*(pow(Q, K, mod)+pow(Q-2*P, K, mod))
        up %= mod
    else:
        up += value[i]*(pow(Q, K, mod)-pow(Q-2*P, K, mod))
ans = up*rev(down) % mod
print(ans)
0