結果

問題 No.269 見栄っ張りの募金活動
ユーザー trmr105trmr105
提出日時 2020-07-30 14:33:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,173 bytes
コンパイル時間 2,053 ms
コンパイル使用メモリ 170,240 KB
実行使用メモリ 19,572 KB
最終ジャッジ日時 2023-09-17 03:05:03
合計ジャッジ時間 2,947 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
4,376 KB
testcase_07 WA -
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 9 ms
10,092 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 WA -
testcase_12 AC 8 ms
8,648 KB
testcase_13 WA -
testcase_14 AC 2 ms
4,376 KB
testcase_15 WA -
testcase_16 AC 8 ms
8,004 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
4,380 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using ll = long long;
using Field = vector<vector<ll>>;
using Graph = vector<vector<ll>>;
using VI = vector<int>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VC = vector<char>;
using PI = pair<int, int>;

#define FOR(i, s, n) for (int i = s; i < (n); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) x.begin(), x.end()

const long long INF = 1LL<<60;
const int mod = 1000000007;

template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }

ll N, S, K;
VVL dp;

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);

    cin >> N >> S >> K;

    dp.assign(N+1, VL(S+1));

    dp[0][0] = 1;

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

    cout << dp[N-1][S] << endl;






    return 0;
}
0