結果

問題 No.269 見栄っ張りの募金活動
ユーザー 4094706840947068
提出日時 2024-01-14 15:35:36
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 988 ms / 5,000 ms
コード長 1,302 bytes
コンパイル時間 5,258 ms
コンパイル使用メモリ 176,580 KB
実行使用メモリ 11,296 KB
最終ジャッジ日時 2024-01-14 15:35:46
合計ジャッジ時間 9,380 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 4 ms
6,676 KB
testcase_04 AC 717 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 1 ms
6,676 KB
testcase_07 AC 988 ms
11,296 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 317 ms
6,676 KB
testcase_12 AC 1 ms
6,676 KB
testcase_13 AC 131 ms
6,676 KB
testcase_14 AC 256 ms
6,676 KB
testcase_15 AC 191 ms
6,676 KB
testcase_16 AC 1 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 198 ms
6,676 KB
testcase_19 AC 64 ms
6,676 KB
testcase_20 AC 47 ms
6,676 KB
testcase_21 AC 218 ms
6,676 KB
testcase_22 AC 48 ms
6,676 KB
testcase_23 AC 3 ms
6,676 KB
testcase_24 AC 130 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
//#include<atcoder/modint>
using namespace std;
using namespace atcoder;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T &a, T b) { return ((a>b) ? (a = b, true) : (false));}
#define rep(i,s,n) for(long long i=s;i<(long long)(n);i++)
#define rrep(i,s,n) for(long long i=n-1;i>=s;i--)
const long long inf = 1LL<<60;
typedef long long ll;
#define cmp [](pair<ll,ll> a, pair<ll,ll> b){return a.second<b.second;} //pairのsecondでソートsort(p.begin(),p.end(),cmp)
typedef pair<long long, long long> P;
typedef pair<ll, pair<ll,ll> > PP;
#define rll ll,vector<ll>,greater<ll>
#define rP P,vector<P>,greater<P>
const long double pi = 3.14159265358979;
typedef unsigned long long ull;

using mint = modint1000000007;

int main()
{
    ll n,s,k; cin >> n >> s >> k;
    ll rest = s - (n-1)*n*k/2;
    if(rest < 0) {
        cout << 0 << endl;
        return 0;
    } else if(rest == 0) {
        cout << 1 << endl;
        return 0;
    }
    mint dp[n+1][rest+1];
    dp[0][rest] = 1;
    rep(i,1,n+1) {
        rep(j,0,rest+1) {
            for(ll k=j;k>=0;k-=i) {
                dp[i][k] += dp[i-1][j];
            }
        }
    }
    cout << dp[n][0].val() << endl;
}
0