結果

問題 No.1011 Infinite Stairs
ユーザー 👑 Kazun
提出日時 2021-02-19 05:08:23
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 407 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 112,500 KB
最終ジャッジ日時 2024-09-15 09:00:29
合計ジャッジ時間 5,028 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 1 TLE * 1 -- * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(step,count):
    if count==0:
        if step==0:
            return 1
        else:
            return 0

    if not count<=step<=d*count:
        return 0

    if (step,count) in Memo:
        return Memo[(step,count)]

    X=0
    for x in range(1,d+1):
        X+=f(step-x,count-1)
    X%=Mod

    Memo[(step,count)]=X
    return X

N,d,K=map(int,input().split())
Mod=10**9+7
Memo={}
print(f(K,N))
0