結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー |
![]() |
提出日時 | 2020-02-20 00:05:09 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,298 bytes |
コンパイル時間 | 1,852 ms |
コンパイル使用メモリ | 162,388 KB |
実行使用メモリ | 19,712 KB |
最終ジャッジ日時 | 2024-11-30 16:31:18 |
合計ジャッジ時間 | 2,859 ms |
ジャッジサーバーID (参考情報) |
judge5 / 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];}}cout << dp[s][n] << endl;}