結果

問題 No.269 見栄っ張りの募金活動
ユーザー alorie10alorie10
提出日時 2019-09-24 14:34:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 77 ms / 5,000 ms
コード長 521 bytes
コンパイル時間 781 ms
コンパイル使用メモリ 64,528 KB
実行使用メモリ 19,420 KB
最終ジャッジ日時 2023-10-19 08:54:12
合計ジャッジ時間 1,867 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 3 ms
4,432 KB
testcase_03 AC 6 ms
5,660 KB
testcase_04 AC 41 ms
19,420 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 77 ms
19,420 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 31 ms
10,656 KB
testcase_10 AC 3 ms
4,348 KB
testcase_11 AC 25 ms
19,420 KB
testcase_12 AC 24 ms
9,780 KB
testcase_13 AC 16 ms
11,108 KB
testcase_14 AC 21 ms
19,420 KB
testcase_15 AC 18 ms
12,976 KB
testcase_16 AC 27 ms
11,512 KB
testcase_17 AC 7 ms
5,696 KB
testcase_18 AC 52 ms
17,200 KB
testcase_19 AC 17 ms
10,920 KB
testcase_20 AC 9 ms
9,608 KB
testcase_21 AC 18 ms
16,960 KB
testcase_22 AC 9 ms
7,988 KB
testcase_23 AC 4 ms
4,708 KB
testcase_24 AC 13 ms
12,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
typedef long long ll;
ll n,s,k,dp[20001][101],MOD=1e9+7;
int main(void){
    cin>>n>>s>>k;
    dp[0][0]=1;
    for(int j=1;j<=n;j++){
        for(int i=0;i<=s;i++){
            if(i-j>=0){
                dp[i][j]+=(dp[i-j][j]+dp[i][j-1]);
                dp[i][j]%=MOD;
            }
            else dp[i][j]=dp[i][j-1];
        }
    }
    //cout<<s-n*(n-1)/2*k<<n<<dp[s-n*(n-1)/2*k][n]<<endl;
    if(s-n*(n-1)/2*k<0)cout<<0<<endl;
    else cout<<dp[s-n*(n-1)/2*k][n]<<endl;
}
0