結果

問題 No.269 見栄っ張りの募金活動
ユーザー hogepagefoobarhogepagefoobar
提出日時 2020-06-29 23:27:17
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 9 ms / 5,000 ms
コード長 1,036 bytes
コンパイル時間 1,385 ms
コンパイル使用メモリ 119,856 KB
実行使用メモリ 10,996 KB
最終ジャッジ日時 2023-08-20 15:47:47
合計ジャッジ時間 2,100 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <bitset>
#include <climits>
#include <complex>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <thread>
#include <tuple>
#include <type_traits>
#include <vector>

#include <stdio.h>

using ll = long long;
using namespace std;
const int M = 1e9 + 7;

int main() {
    ios::sync_with_stdio(false);
    int n, s, k;
    cin >> n >> s >> k;

    int st = k * n * (n - 1) / 2;
    vector<vector<int>> dp(n + 1, vector<int>(s + 1));
    dp[0][0] = 1;

    if (st > s) {
        cout << 0 << endl;
    } else {
        s -= st;
        for (int i = 1; i <= n; i++) {
            for (int j = 0; j <= s; j++) {
                if (j - i >= 0)
                    dp[i][j] = (dp[i][j - i] + dp[i - 1][j]) % M;
                else
                    dp[i][j] = dp[i - 1][j];
            }
        }
        cout << dp[n][s] << endl;
    }

    return 0;
}
0