結果

問題 No.1489 Repeat Cumulative Sum
コンテスト
ユーザー LyricalMaestro
提出日時 2025-11-25 00:12:24
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 651 bytes
コンパイル時間 463 ms
コンパイル使用メモリ 82,596 KB
実行使用メモリ 91,620 KB
最終ジャッジ日時 2025-11-25 00:12:31
合計ジャッジ時間 6,827 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

## https://yukicoder.me/problems/no/1693

MOD = 10 ** 9 + 7
MAX_INT = 10 ** 18

def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))

    answer = 0
    c = 1
    m0 = M
    m1 = 1
    for a in reversed(A):
        c *= m0
        c %= MOD
        c *= pow(m1, MOD - 2, MOD)
        c %= MOD

        d = (c - 1) % MOD
        answer += (a * d) % MOD
        answer %= MOD
        print(a, answer)

        m0 += 1
        m0 %= MOD
        m1 += 1
        m1 %= MOD
    
    for a in A:
        answer += a
        answer %= MOD
    print(answer)





    


        

    



if __name__ == "__main__":
    main()
0