結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-27 02:35:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 948 bytes |
| コンパイル時間 | 1,494 ms |
| コンパイル使用メモリ | 167,236 KB |
| 実行使用メモリ | 19,072 KB |
| 最終ジャッジ日時 | 2024-07-05 18:29:11 |
| 合計ジャッジ時間 | 3,563 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 RE * 1 |
| other | AC * 17 RE * 5 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MOD = 1000000007;
const ll INF = 1001001001001001001;
const int inf = 1001001001;
using P = pair<ll, ll>;
struct edge {
int to, cost;
};
bool comp(P l, P r) {
return ((l.first < r.first) || ((l.first == r.first) && (l.second > r.second)));
}
int main() {
int N, S, K;cin>> N >> S >> K;
if (S-N*(N -1)*K/2 < 0) {
cout << 0 << endl;
return 0;
}
ll dp[N+1][S-N*(N-1)*K/2+1] = {0LL};
for (int i = 0; i <= 20010; i++) {
dp[1][i] = 1LL;
}
for (int i = 2; i <= N; i++) {
for (int j = 0; j <= S-N*(N-1)*K/2; j++) {
if (j >= i) {
dp[i][j] = (dp[i][j-i]+dp[i-1][j])%MOD;
} else {
dp[i][j] = (dp[i-1][j])%MOD;
}
}
}
cout << dp[N][S-N*(N-1)*K/2]%MOD << endl;
return 0;
}