結果

問題 No.1011 Infinite Stairs
ユーザー convexineqconvexineq
提出日時 2020-03-20 21:46:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 383 ms / 2,000 ms
コード長 554 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 87,212 KB
実行使用メモリ 77,432 KB
最終ジャッジ日時 2023-09-24 10:56:12
合計ジャッジ時間 5,616 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,528 KB
testcase_01 AC 72 ms
71,468 KB
testcase_02 AC 90 ms
76,032 KB
testcase_03 AC 279 ms
77,020 KB
testcase_04 AC 383 ms
77,120 KB
testcase_05 AC 382 ms
77,432 KB
testcase_06 AC 72 ms
71,104 KB
testcase_07 AC 115 ms
76,220 KB
testcase_08 AC 73 ms
71,116 KB
testcase_09 AC 78 ms
75,964 KB
testcase_10 AC 88 ms
75,928 KB
testcase_11 AC 205 ms
76,672 KB
testcase_12 AC 82 ms
75,712 KB
testcase_13 AC 142 ms
76,456 KB
testcase_14 AC 84 ms
75,836 KB
testcase_15 AC 120 ms
76,376 KB
testcase_16 AC 290 ms
77,032 KB
testcase_17 AC 303 ms
77,020 KB
testcase_18 AC 167 ms
76,488 KB
testcase_19 AC 79 ms
75,864 KB
testcase_20 AC 85 ms
75,976 KB
testcase_21 AC 126 ms
76,204 KB
testcase_22 AC 267 ms
77,100 KB
testcase_23 AC 123 ms
76,496 KB
testcase_24 AC 121 ms
76,480 KB
testcase_25 AC 166 ms
76,420 KB
testcase_26 AC 99 ms
76,312 KB
権限があれば一括ダウンロードができます

ソースコード

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