結果

問題 No.269 見栄っ張りの募金活動
ユーザー ytrjpnytrjpn
提出日時 2021-08-22 02:53:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 67 ms / 5,000 ms
コード長 523 bytes
コンパイル時間 319 ms
コンパイル使用メモリ 82,260 KB
実行使用メモリ 76,948 KB
最終ジャッジ日時 2024-04-23 17:21:47
合計ジャッジ時間 2,067 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
53,624 KB
testcase_01 AC 33 ms
52,028 KB
testcase_02 AC 32 ms
53,492 KB
testcase_03 AC 41 ms
61,636 KB
testcase_04 AC 50 ms
66,000 KB
testcase_05 AC 38 ms
58,336 KB
testcase_06 AC 34 ms
52,952 KB
testcase_07 AC 67 ms
76,948 KB
testcase_08 AC 33 ms
52,608 KB
testcase_09 AC 34 ms
53,072 KB
testcase_10 AC 35 ms
52,016 KB
testcase_11 AC 40 ms
61,024 KB
testcase_12 AC 33 ms
53,656 KB
testcase_13 AC 42 ms
61,968 KB
testcase_14 AC 39 ms
59,908 KB
testcase_15 AC 41 ms
61,084 KB
testcase_16 AC 33 ms
53,124 KB
testcase_17 AC 33 ms
53,032 KB
testcase_18 AC 47 ms
66,204 KB
testcase_19 AC 43 ms
61,436 KB
testcase_20 AC 39 ms
60,184 KB
testcase_21 AC 39 ms
61,080 KB
testcase_22 AC 42 ms
61,388 KB
testcase_23 AC 37 ms
59,788 KB
testcase_24 AC 40 ms
60,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# [分割数]S-N*(N-1)*K//2個の互いに区別できない品物を、N個以下に分割する方法の総数を求め、modで割った余りを出力
mod=10**9+7
N,S,K=map(int, input().split())

n=S-N*(N-1)*K//2
m=N
M=mod

if n>=0:
    dp = [[0] * (n+1) for i in range(m+1)]
    dp[0][0]=1
    for i in range(1,m+1):
        for j in range(0,n+1):
            if j-i>=0:
                dp[i][j]=(dp[i-1][j]+dp[i][j-i])%M
            else:
                dp[i][j]=dp[i-1][j]%M
    print(dp[-1][-1])
else:
    print(0)
0