結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-08-10 05:15:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,059 bytes |
| コンパイル時間 | 579 ms |
| コンパイル使用メモリ | 73,252 KB |
| 実行使用メモリ | 814,464 KB |
| 最終ジャッジ日時 | 2024-09-23 05:24:31 |
| 合計ジャッジ時間 | 2,685 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 MLE * 1 -- * 1 |
| other | WA * 1 -- * 21 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll N, S, K;
cin >> N >> S >> K;
S = S - N * (N - 1) / 2 * K;
ll dp[N + 1][S + 1];
ll mod = 1e9 + 7;
memset(dp, 0, sizeof(dp));
dp[0][0] = 1;
rep(i, 1, N + 1) rep(j, 0, S + 1) {
if(j - i >= 0) dp[i][j] = (dp[i - 1][j] + dp[i][j - i]) % mod;
else dp[i][j] = dp[i - 1][j];
}
cout << dp[N][S] << endl;
}