結果

問題 No.269 見栄っ張りの募金活動
ユーザー tmg_dayotmg_dayo
提出日時 2019-09-24 22:16:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 511 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 11,788 KB
実行使用メモリ 89,140 KB
最終ジャッジ日時 2023-10-19 16:02:24
合計ジャッジ時間 3,676 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,044 KB
testcase_01 AC 29 ms
10,044 KB
testcase_02 AC 29 ms
10,044 KB
testcase_03 AC 47 ms
12,240 KB
testcase_04 AC 250 ms
38,324 KB
testcase_05 AC 30 ms
10,148 KB
testcase_06 AC 30 ms
10,044 KB
testcase_07 AC 653 ms
89,140 KB
testcase_08 AC 29 ms
10,048 KB
testcase_09 AC 30 ms
10,044 KB
testcase_10 WA -
testcase_11 AC 82 ms
16,680 KB
testcase_12 AC 31 ms
10,044 KB
testcase_13 AC 102 ms
19,368 KB
testcase_14 AC 49 ms
12,268 KB
testcase_15 AC 97 ms
18,576 KB
testcase_16 AC 30 ms
10,044 KB
testcase_17 AC 30 ms
10,044 KB
testcase_18 AC 240 ms
37,320 KB
testcase_19 AC 91 ms
18,048 KB
testcase_20 AC 44 ms
11,852 KB
testcase_21 AC 50 ms
12,500 KB
testcase_22 AC 70 ms
15,248 KB
testcase_23 AC 35 ms
10,652 KB
testcase_24 AC 53 ms
13,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    n,s,k=map(int,input().split())
    s=s-(k*n*(n-1))//2
    M=10**9+7
    if s<=0:
        print(0)
    else:
        dp=[[1]*n for _ in [0]*(s+1)]
        for i in range(1,s+1):
            for j in range(n):
                if j==0:
                    dp[i][j]=dp[i-1][j]
                elif i-j-1<0:
                    dp[i][j]=dp[i][j-1]
                else:
                    dp[i][j]=(dp[i][j-1]+dp[i-j-1][j])%M        
        print(dp[s][n-1])
    
if __name__ == '__main__':
	main()
0