結果

問題 No.269 見栄っ張りの募金活動
ユーザー yomayoma
提出日時 2019-10-11 18:58:06
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 73 ms / 5,000 ms
コード長 937 bytes
コンパイル時間 1,501 ms
コンパイル使用メモリ 168,300 KB
実行使用メモリ 21,032 KB
最終ジャッジ日時 2023-08-16 12:44:05
合計ジャッジ時間 4,541 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
20,948 KB
testcase_01 AC 71 ms
20,980 KB
testcase_02 AC 15 ms
20,916 KB
testcase_03 AC 70 ms
20,920 KB
testcase_04 AC 71 ms
20,848 KB
testcase_05 AC 72 ms
20,940 KB
testcase_06 AC 73 ms
20,856 KB
testcase_07 AC 73 ms
20,860 KB
testcase_08 AC 71 ms
20,860 KB
testcase_09 AC 15 ms
20,940 KB
testcase_10 AC 70 ms
21,032 KB
testcase_11 AC 70 ms
20,972 KB
testcase_12 AC 15 ms
20,944 KB
testcase_13 AC 71 ms
20,848 KB
testcase_14 AC 71 ms
20,916 KB
testcase_15 AC 70 ms
20,980 KB
testcase_16 AC 15 ms
20,848 KB
testcase_17 AC 16 ms
20,972 KB
testcase_18 AC 72 ms
20,916 KB
testcase_19 AC 70 ms
20,888 KB
testcase_20 AC 71 ms
20,844 KB
testcase_21 AC 70 ms
20,844 KB
testcase_22 AC 71 ms
20,848 KB
testcase_23 AC 69 ms
20,884 KB
testcase_24 AC 70 ms
20,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define EM 1000000
using namespace std;
using LL = long long;
using P = pair<LL, LL>;
LL LINF = 1e18;
int INF = 1e9;
LL mod = 1e9+7;
using vint = vector<int>;
using vLL = vector<LL>;
using vvint = vector<vector<int>>;
using vvLL = vector<vector<LL>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


vector<vector<LL>>  dp(20010, vector<LL>(110, 0));

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