結果

問題 No.269 見栄っ張りの募金活動
ユーザー hk0209hk0209
提出日時 2021-03-01 15:34:02
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 22 ms / 5,000 ms
コード長 804 bytes
コンパイル時間 1,924 ms
コンパイル使用メモリ 167,240 KB
実行使用メモリ 19,584 KB
最終ジャッジ日時 2024-04-14 03:43:34
合計ジャッジ時間 3,151 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 3 ms
6,944 KB
testcase_04 AC 9 ms
9,088 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 22 ms
19,584 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 4 ms
6,940 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 4 ms
6,940 KB
testcase_14 AC 3 ms
6,940 KB
testcase_15 AC 4 ms
6,940 KB
testcase_16 AC 3 ms
6,940 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 9 ms
8,832 KB
testcase_19 AC 4 ms
6,944 KB
testcase_20 AC 3 ms
6,940 KB
testcase_21 AC 3 ms
6,944 KB
testcase_22 AC 4 ms
6,940 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 3 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPE(i,l,n) for(ll i=l;i<=ll(n);i++)
#define FORA(i,I) for(const auto& i:I)
#define ALL(v) v.begin(),v.end()
#define P(str) cout << str << endl
#define VLL vector<ll>
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
constexpr int64_t INF = 1e18;

int main() {
    ll n, s, k, a, mod = 1000000007;
    cin >> n >> s >> k;
    a = s - n * (n - 1)* k / 2;
    if(a < 0) {
        P(0);
        return 0;
    }
    vector<VLL> dp(n + 1, VLL(a + 1));
    dp[0][0] = 1;
    REPE(i, 1, n)REPE(j, 0, a){
        if(j - i >= 0) dp[i][j] = (dp[i][j - i] + dp[i - 1][j]) % mod;
        else dp[i][j] = dp[i - 1][j]; 
    }
    P(dp[n][a]);
}          
0