結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-23 15:35:08 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 5,000 ms |
| コード長 | 1,217 bytes |
| コンパイル時間 | 523 ms |
| コンパイル使用メモリ | 81,076 KB |
| 実行使用メモリ | 18,944 KB |
| 最終ジャッジ日時 | 2024-07-05 09:27:36 |
| 合計ジャッジ時間 | 1,329 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <stack>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <deque>
#include <functional>
#define _USE_MATH_DEFINES
#include <math.h>
#include <complex>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define RREP(i,n) for(int i = (int)n-1; i >= 0; i--)
#define LREP(i,n) for(LL i = 0; i < (LL)n; i++)
#define Vi vector<int>
#define Vl vector<long long>
#define LP pair<long long ,long long>
#define P pair<int, int>
#define T3 tuple<LL, LL, LL>
#define T4 tuple<LL, LL, LL, LL>
#define INF 1000000007
#define SIZE 200010
#define MOD 1000000007
typedef long long LL;
int N, S, K;
LL dp[110][20010];
int main() {
cin >> N >> S >> K;
dp[0][0] = 1;
for (int i = 1; i < N; i++) {
for (int s = 0; s <= S; s++) {
dp[i][s] = dp[i - 1][s];
if (s - i >= 0) dp[i][s] += dp[i][s - i];
dp[i][s] %= MOD;
}
}
LL ans = 0;
for (int a = 0; a <= S; a++) {
int s = S - N * a - N * (N - 1) * K / 2;
if (s >= 0) ans = (ans + dp[N - 1][s]) % MOD;
}
cout << ans << endl;
}