結果

問題 No.1489 Repeat Cumulative Sum
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-04-23 22:51:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 193 ms / 2,000 ms
コード長 278 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 92,540 KB
最終ジャッジ日時 2023-09-17 12:52:15
合計ジャッジ時間 6,018 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,468 KB
testcase_01 AC 75 ms
71,328 KB
testcase_02 AC 74 ms
71,492 KB
testcase_03 AC 168 ms
88,684 KB
testcase_04 AC 161 ms
87,332 KB
testcase_05 AC 169 ms
88,528 KB
testcase_06 AC 153 ms
85,996 KB
testcase_07 AC 131 ms
82,280 KB
testcase_08 AC 112 ms
79,452 KB
testcase_09 AC 180 ms
90,836 KB
testcase_10 AC 167 ms
88,636 KB
testcase_11 AC 148 ms
85,676 KB
testcase_12 AC 84 ms
76,636 KB
testcase_13 AC 146 ms
84,412 KB
testcase_14 AC 190 ms
92,260 KB
testcase_15 AC 185 ms
92,348 KB
testcase_16 AC 137 ms
83,192 KB
testcase_17 AC 143 ms
84,300 KB
testcase_18 AC 127 ms
82,476 KB
testcase_19 AC 110 ms
79,540 KB
testcase_20 AC 120 ms
81,012 KB
testcase_21 AC 154 ms
85,676 KB
testcase_22 AC 88 ms
76,784 KB
testcase_23 AC 104 ms
77,960 KB
testcase_24 AC 77 ms
71,280 KB
testcase_25 AC 97 ms
76,960 KB
testcase_26 AC 193 ms
92,540 KB
testcase_27 AC 138 ms
85,420 KB
testcase_28 AC 87 ms
76,696 KB
testcase_29 AC 117 ms
82,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
A = list(map(int,input().split()))
A = A[::-1]
mod = 10**9+7

ans = 0
prod = 1
base = 1
for i in range(n-1):
    prod *= m+i
    prod %= mod
    base *= (i+1)
    base %= mod
    ans += A[i]*prod*pow(base,mod-2,mod)
    ans %= mod

print(ans)




0