結果

問題 No.269 見栄っ張りの募金活動
ユーザー yaoshimaxyaoshimax
提出日時 2016-05-11 22:45:07
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 407 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 7,196 KB
実行使用メモリ 69,196 KB
最終ジャッジ日時 2024-04-15 15:14:23
合計ジャッジ時間 4,297 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,400 KB
testcase_01 AC 11 ms
6,272 KB
testcase_02 AC 11 ms
6,400 KB
testcase_03 AC 47 ms
8,064 KB
testcase_04 AC 482 ms
28,288 KB
testcase_05 AC 12 ms
6,528 KB
testcase_06 AC 12 ms
6,528 KB
testcase_07 AC 1,406 ms
69,196 KB
testcase_08 AC 12 ms
6,272 KB
testcase_09 AC 11 ms
6,272 KB
testcase_10 AC 11 ms
6,400 KB
testcase_11 RE -
testcase_12 AC 11 ms
6,144 KB
testcase_13 AC 158 ms
13,568 KB
testcase_14 RE -
testcase_15 AC 140 ms
12,928 KB
testcase_16 AC 11 ms
6,272 KB
testcase_17 AC 11 ms
6,272 KB
testcase_18 AC 475 ms
27,520 KB
testcase_19 AC 140 ms
12,544 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 93 ms
10,368 KB
testcase_23 AC 21 ms
6,912 KB
testcase_24 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,S,K=map(int,raw_input().split())
S-=K*N*(N-1)/2
if S < 0:
    print 0
    exit()

dp=[[-1 for i in range(S+1)] for k in range(N+1)]
mod=1000000007

def rec(N,S):
    if S<0:
        return 0
    if dp[N][S]!=-1:
        return dp[N][S]
    if N==1:
        dp[N][S]=1
        return dp[N][S]
    dp[N][S]=rec(N,S-N)+rec(N-1,S)
    dp[N][S]%=mod
    #print N,S,dp[N][S]
    return dp[N][S]

print rec(N,S)
0