結果

問題 No.1489 Repeat Cumulative Sum
ユーザー ayaoniayaoni
提出日時 2021-04-23 22:25:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 643 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 90,832 KB
最終ジャッジ日時 2024-07-04 08:16:50
合計ジャッジ時間 4,653 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,096 KB
testcase_01 AC 39 ms
51,840 KB
testcase_02 AC 40 ms
52,224 KB
testcase_03 AC 136 ms
87,168 KB
testcase_04 AC 130 ms
85,632 KB
testcase_05 AC 137 ms
87,040 KB
testcase_06 AC 119 ms
84,096 KB
testcase_07 AC 93 ms
79,104 KB
testcase_08 AC 75 ms
71,680 KB
testcase_09 AC 148 ms
89,088 KB
testcase_10 AC 136 ms
86,912 KB
testcase_11 AC 117 ms
84,096 KB
testcase_12 AC 50 ms
61,824 KB
testcase_13 AC 110 ms
82,944 KB
testcase_14 AC 153 ms
90,624 KB
testcase_15 AC 153 ms
90,832 KB
testcase_16 AC 103 ms
81,664 KB
testcase_17 AC 108 ms
82,816 KB
testcase_18 AC 92 ms
78,080 KB
testcase_19 AC 75 ms
71,296 KB
testcase_20 AC 84 ms
74,624 KB
testcase_21 AC 118 ms
84,480 KB
testcase_22 AC 52 ms
62,464 KB
testcase_23 AC 67 ms
66,048 KB
testcase_24 AC 39 ms
51,584 KB
testcase_25 AC 64 ms
66,304 KB
testcase_26 AC 157 ms
90,752 KB
testcase_27 AC 104 ms
76,672 KB
testcase_28 AC 51 ms
62,080 KB
testcase_29 AC 87 ms
71,936 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