結果

問題 No.1489 Repeat Cumulative Sum
ユーザー ayaoniayaoni
提出日時 2021-04-23 22:25:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 185 ms / 2,000 ms
コード長 643 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 92,116 KB
最終ジャッジ日時 2023-09-17 12:32:40
合計ジャッジ時間 5,442 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,512 KB
testcase_01 AC 80 ms
71,188 KB
testcase_02 AC 76 ms
71,420 KB
testcase_03 AC 161 ms
88,344 KB
testcase_04 AC 151 ms
86,952 KB
testcase_05 AC 160 ms
88,424 KB
testcase_06 AC 146 ms
85,736 KB
testcase_07 AC 125 ms
82,208 KB
testcase_08 AC 107 ms
78,888 KB
testcase_09 AC 172 ms
90,200 KB
testcase_10 AC 162 ms
88,528 KB
testcase_11 AC 144 ms
85,528 KB
testcase_12 AC 86 ms
76,720 KB
testcase_13 AC 142 ms
84,316 KB
testcase_14 AC 184 ms
92,008 KB
testcase_15 AC 174 ms
91,844 KB
testcase_16 AC 131 ms
83,500 KB
testcase_17 AC 137 ms
84,220 KB
testcase_18 AC 123 ms
82,144 KB
testcase_19 AC 108 ms
78,832 KB
testcase_20 AC 116 ms
80,592 KB
testcase_21 AC 148 ms
85,632 KB
testcase_22 AC 88 ms
76,600 KB
testcase_23 AC 101 ms
78,052 KB
testcase_24 AC 77 ms
71,172 KB
testcase_25 AC 95 ms
77,096 KB
testcase_26 AC 185 ms
92,116 KB
testcase_27 AC 132 ms
84,976 KB
testcase_28 AC 85 ms
76,740 KB
testcase_29 AC 115 ms
81,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


N,M = MI()
A = LI()
A.reverse()
mod = 10**9+7

c = 1
ans = 0
for i in range(N-1):
    a = A[i]
    c *= M+i
    c *= pow(i+1,mod-2,mod)
    c %= mod
    ans += a*c
    ans %= mod

print(ans)
0