結果

問題 No.269 見栄っ張りの募金活動
ユーザー cardano1016cardano1016
提出日時 2020-02-19 23:59:49
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,298 bytes
コンパイル時間 1,812 ms
コンパイル使用メモリ 192,104 KB
最終ジャッジ日時 2025-01-09 01:07:19
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
    auto val = table(args...);
    return vector<decltype(val)>(n, move(val));
}
const ll INF = 1e9;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,s,k;
    ll dp[20005][105];
    cin >> n >> s >> k;
    s -= k*n*(n-1)/2;
    if (s < 0){
        PRINT(0);
        return 0;
    }
    dp[0][0] = 1;
    rep(i,s+1){
        rep(j,1,n+1){
            if (i-j >= 0) dp[i][j] = (dp[i][j-1]+dp[i-j][j])%MOD;
            else dp[i][j] = dp[i][j-1];
        }
    }
    cout << dp[s][n] << endl;
}
0