結果

問題 No.269 見栄っ張りの募金活動
ユーザー pockynypockyny
提出日時 2021-02-24 21:59:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 64 ms / 5,000 ms
コード長 449 bytes
コンパイル時間 721 ms
コンパイル使用メモリ 68,724 KB
実行使用メモリ 19,268 KB
最終ジャッジ日時 2023-10-25 03:36:02
合計ジャッジ時間 2,335 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 2 ms
4,372 KB
testcase_02 AC 2 ms
4,372 KB
testcase_03 AC 7 ms
4,936 KB
testcase_04 AC 25 ms
9,576 KB
testcase_05 AC 2 ms
4,372 KB
testcase_06 AC 3 ms
4,372 KB
testcase_07 AC 64 ms
19,268 KB
testcase_08 AC 2 ms
4,372 KB
testcase_09 AC 29 ms
10,860 KB
testcase_10 AC 2 ms
4,372 KB
testcase_11 AC 8 ms
5,200 KB
testcase_12 AC 23 ms
9,300 KB
testcase_13 AC 10 ms
5,648 KB
testcase_14 AC 3 ms
4,372 KB
testcase_15 AC 9 ms
5,460 KB
testcase_16 AC 21 ms
8,772 KB
testcase_17 AC 6 ms
4,736 KB
testcase_18 AC 40 ms
13,560 KB
testcase_19 AC 11 ms
6,208 KB
testcase_20 AC 4 ms
4,372 KB
testcase_21 AC 4 ms
4,372 KB
testcase_22 AC 6 ms
4,800 KB
testcase_23 AC 3 ms
4,372 KB
testcase_24 AC 4 ms
4,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;
typedef long long ll;
ll mod = 1000000007,dp[110][20010] = {}; // num/sum like partition dp
int main(){
    int i,j,n,s,k; cin >> n >> s >> k;
    dp[0][0] = 1;
    for(i=1;i<=n;i++){
        for(j=0;j<=s;j++){
            if(j>=i) (dp[i][j] += dp[i][j - i]) %= mod; //0 nasi
            if(j>=k*(i - 1)) (dp[i][j] += dp[i - 1][j - k*(i - 1)]) %= mod; //0 ari
        }
    }
    cout << dp[n][s] << endl;
}
0