結果

問題 No.269 見栄っ張りの募金活動
ユーザー cardano1016cardano1016
提出日時 2020-02-20 00:05:09
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,298 bytes
コンパイル時間 2,180 ms
コンパイル使用メモリ 133,240 KB
実行使用メモリ 19,976 KB
最終ジャッジ日時 2023-08-20 14:01:59
合計ジャッジ時間 2,793 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 3 ms
6,028 KB
testcase_04 AC 13 ms
18,700 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 12 ms
16,144 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 10 ms
10,648 KB
testcase_14 WA -
testcase_15 AC 9 ms
12,468 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 7 ms
11,660 KB
testcase_19 AC 7 ms
8,284 KB
testcase_20 AC 5 ms
8,884 KB
testcase_21 AC 14 ms
17,080 KB
testcase_22 AC 5 ms
7,700 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 8 ms
12,476 KB
権限があれば一括ダウンロードができます

ソースコード

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