結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
hk0209
|
| 提出日時 | 2021-03-01 15:34:02 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 5,000 ms |
| コード長 | 804 bytes |
| コンパイル時間 | 1,713 ms |
| コンパイル使用メモリ | 170,880 KB |
| 実行使用メモリ | 19,712 KB |
| 最終ジャッジ日時 | 2024-10-03 00:52:58 |
| 合計ジャッジ時間 | 2,417 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPE(i,l,n) for(ll i=l;i<=ll(n);i++)
#define FORA(i,I) for(const auto& i:I)
#define ALL(v) v.begin(),v.end()
#define P(str) cout << str << endl
#define VLL vector<ll>
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
constexpr int64_t INF = 1e18;
int main() {
ll n, s, k, a, mod = 1000000007;
cin >> n >> s >> k;
a = s - n * (n - 1)* k / 2;
if(a < 0) {
P(0);
return 0;
}
vector<VLL> dp(n + 1, VLL(a + 1));
dp[0][0] = 1;
REPE(i, 1, n)REPE(j, 0, a){
if(j - i >= 0) dp[i][j] = (dp[i][j - i] + dp[i - 1][j]) % mod;
else dp[i][j] = dp[i - 1][j];
}
P(dp[n][a]);
}
hk0209