結果
問題 | No.1489 Repeat Cumulative Sum |
ユーザー |
![]() |
提出日時 | 2023-11-19 13:39:36 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 174 ms / 2,000 ms |
コード長 | 314 bytes |
コンパイル時間 | 248 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 92,144 KB |
最終ジャッジ日時 | 2024-09-26 06:16:21 |
合計ジャッジ時間 | 4,650 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
N, M = map(int, input().split())N -= 1A = list(map(int, input().split())) + [0]mod = 10**9 + 7comb = M + 1ans = 0now = 1for i in range(N - 1, -1, -1):ans += (A[i] - A[i - 1]) * (comb - 1)ans %= modcomb *= (M + 1 + now) * pow(now + 1, mod - 2, mod)comb %= modnow += 1print(ans)