結果

問題 No.269 見栄っ張りの募金活動
ユーザー utanutan
提出日時 2021-04-27 02:35:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 948 bytes
コンパイル時間 1,617 ms
コンパイル使用メモリ 164,400 KB
実行使用メモリ 19,288 KB
最終ジャッジ日時 2023-09-19 06:14:38
合計ジャッジ時間 3,986 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 RE -
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 12 ms
8,932 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 29 ms
19,288 KB
testcase_08 RE -
testcase_09 AC 2 ms
4,376 KB
testcase_10 RE -
testcase_11 AC 4 ms
4,588 KB
testcase_12 AC 2 ms
4,384 KB
testcase_13 AC 5 ms
5,176 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 6 ms
5,292 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 11 ms
8,792 KB
testcase_19 AC 5 ms
4,996 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,384 KB
testcase_22 AC 4 ms
4,376 KB
testcase_23 RE -
testcase_24 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;


typedef long long ll;
ll MOD = 1000000007;

const ll INF = 1001001001001001001;
const int inf = 1001001001;
using P = pair<ll, ll>;

struct edge {
    int to, cost;
};

bool comp(P l, P r) {
    return ((l.first < r.first) || ((l.first == r.first) && (l.second > r.second)));
    
}

int main() {
    int N, S, K;cin>> N >> S >> K;
    if (S-N*(N -1)*K/2 < 0) {
        cout << 0 << endl;
        return 0;
    }
    ll dp[N+1][S-N*(N-1)*K/2+1] = {0LL};
    for (int i = 0; i <= 20010; i++) {
        dp[1][i] = 1LL;

    }
    for (int i = 2; i <= N; i++) {
        for (int j = 0; j <= S-N*(N-1)*K/2; j++) {
            if (j >= i) {
                dp[i][j] = (dp[i][j-i]+dp[i-1][j])%MOD;
            } else {
                dp[i][j] = (dp[i-1][j])%MOD;
            }

        }
    }
    cout << dp[N][S-N*(N-1)*K/2]%MOD << endl;
    return 0;
}
    
    
        
        
        
    
    


0