結果
| 問題 | 
                            No.269 見栄っ張りの募金活動
                             | 
                    
| コンテスト | |
| ユーザー | 
                             cardano1016
                         | 
                    
| 提出日時 | 2020-02-19 23:54:41 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,289 bytes | 
| コンパイル時間 | 1,561 ms | 
| コンパイル使用メモリ | 166,528 KB | 
| 実行使用メモリ | 20,044 KB | 
| 最終ジャッジ日時 | 2024-10-08 18:26:41 | 
| 合計ジャッジ時間 | 2,500 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 20 WA * 2 | 
ソースコード
#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];
        }
    }
    PRINT(dp[s][n]);
}
            
            
            
        
            
cardano1016