結果

問題 No.269 見栄っ張りの募金活動
ユーザー snbnsnbn
提出日時 2019-09-18 00:00:53
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 16 ms / 5,000 ms
コード長 995 bytes
コンパイル時間 2,289 ms
コンパイル使用メモリ 93,000 KB
実行使用メモリ 19,216 KB
最終ジャッジ日時 2023-09-21 20:25:32
合計ジャッジ時間 2,345 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 3 ms
5,408 KB
testcase_04 AC 9 ms
19,112 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 16 ms
19,128 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 7 ms
11,512 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 7 ms
19,216 KB
testcase_12 AC 6 ms
9,468 KB
testcase_13 AC 6 ms
11,624 KB
testcase_14 AC 7 ms
19,116 KB
testcase_15 AC 5 ms
13,560 KB
testcase_16 AC 7 ms
11,556 KB
testcase_17 AC 4 ms
7,436 KB
testcase_18 AC 9 ms
17,652 KB
testcase_19 AC 5 ms
11,644 KB
testcase_20 AC 4 ms
9,512 KB
testcase_21 AC 6 ms
17,648 KB
testcase_22 AC 4 ms
9,460 KB
testcase_23 AC 3 ms
4,400 KB
testcase_24 AC 5 ms
13,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

const uint64_t MOD = 1'000'000'007L;

int64_t dp[20'001][101];

int main()
{
    int n, s, k;
    cin >> n >> s >> k;

    irep(i, s) irep(j, n)
    {
        if (j == 0) {
            dp[i][j] = i == 0 ? 1 : 0;
        } else {
            dp[i][j] = 0;
            if (i - j >= 0) {
                dp[i][j] += dp[i - j][j];
                dp[i][j] %= MOD;
            }
            if (i - k * (j - 1) >= 0) {
                dp[i][j] += dp[i - k * (j - 1)][j - 1];
                dp[i][j] %= MOD;
            }
        }
    }
    cout << dp[s][n] << endl;

    return 0;
}
0