結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-24 17:52:48 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 5,000 ms |
| コード長 | 1,775 bytes |
| コンパイル時間 | 1,435 ms |
| コンパイル使用メモリ | 167,752 KB |
| 実行使用メモリ | 11,464 KB |
| 最終ジャッジ日時 | 2024-07-04 09:09:56 |
| 合計ジャッジ時間 | 2,558 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <ll, ll> P;
#define rep(i,n) for ( int i =0 ; i < (n); i ++)
#define ALL(x) x.begin(),x.end()
template<class T> bool chmax(T &a, T b) {if (a < b) {a = b;return true;}else return false;}
template<class T> bool chmin(T &a, T b) {if (a > b) {a = b;return true;}else return false;}
const int INF = (1<<30)-1;
const ll LINF = 1e18;
const int mod = 1000000007;
#define LOCAL
#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#define vdbg(x) cerr << __LINE__ << " : " << #x << " = "; copy((x).begin(), (x).end(), ostream_iterator<ll>(cerr, "; ")); cerr << endl;
#define vvdbg(x) cerr << __LINE__ << " : " << #x << " = " << endl; for ( auto i: (x) ){ copy((i).begin(), (i).end(), ostream_iterator<ll>(cerr, "; ")); cerr << endl;}
#define pdbg(x) cerr << __LINE__ << " : " << #x << " = " ; for ( auto i: (x) ) cerr <<'(' << i.first<< ' ' << i.second << ')'<< ", "; cerr << endl;
#define vpdbg(x) cerr << __LINE__ << " : " << #x << " = " << endl ; for (auto j:(x) ) {for ( auto i: (j) ) cerr << '(' << i.first<< ' ' << i.second << ')'<< ", "; cerr << endl;}
#else
#define dbg(x) true
#define vdbg(x) true
#define vvdbg(x) true
#define pdbg(x) true
#define vpdbg(x) true
#endif
int main() {
//入力
int n,s,k; scanf("%d %d %d",&n, &s, &k);
int dp[101][20001];
// dpを作っていく
rep(i,20001) dp[0][i] = 0;
rep(i, 101)dp[i][0] = 1;
rep(i,n)rep(j,s){
dp[i+1][j+1] =dp[i][j+1];
if ( j-i >=0) dp[i+1][j+1] += dp[i+1][j-i] % mod;
dp[i+1][j+1] %= mod;
}
if (s - (n-1) * n /2 *k < 0) {
cout << 0 << endl;
return 0;
}
cout << dp[n][s - (n-1) * n /2 *k] << endl;
// rep(i,10){
// rep(j,10) cout << dp[i][j] << ' ';
// cout << endl;
// }
}