結果

問題 No.1011 Infinite Stairs
ユーザー convexineq
提出日時 2020-03-20 21:46:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 352 ms / 2,000 ms
コード長 554 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 82,456 KB
実行使用メモリ 62,828 KB
最終ジャッジ日時 2024-07-17 11:47:57
合計ジャッジ時間 4,538 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

n,d,k = [int(i) for i in read().split()]
MOD = 10**9+7


def mul(c,m,dp): #multiply (1-x^c) up to x^m
    for i in range(m,c-1,-1):
        dp[i] -= dp[i-c]
        dp[i] %= MOD
 
def div(c,m,dp): #divide by (1-x^c) up to x^m
    for i in range(m-c+1):
        dp[i+c] += dp[i]
        dp[i+c] %= MOD

L = n*d
f = [1]+[0]*L
for _ in range(n):
    mul(d,L,f)
for _ in range(n):
    div(1,L,f)

    #print(dp)

print(f[k-n]%MOD)
0