結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
huka_huka
|
| 提出日時 | 2021-09-25 13:33:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 20 ms / 5,000 ms |
| コード長 | 884 bytes |
| コンパイル時間 | 1,644 ms |
| コンパイル使用メモリ | 163,432 KB |
| 実行使用メモリ | 11,648 KB |
| 最終ジャッジ日時 | 2024-07-05 12:04:33 |
| 合計ジャッジ時間 | 2,530 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
# ifndef ONLINE_JUDGE
# define _GLIBCXX_DEBUG
# endif
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pii = pair<int, int>;
# define rep(i, n) for(int i = 0; i < (int)(n); ++i)
# define all(v) v.begin(), v.end()
int main(){
constexpr char endl = '\n';
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(10);
//input();
int N, S, K;cin >> N >> S >> K;
//solve();
S -= (N-1)*N/2*K;
if(S < 0){
cout << 0 << endl;
return 0;
}
int mod = 1e9+7;
//dp[i][j]:=iのj分割の総和
vvi dp(S+1, vi(N+1));
dp[0][0] = 1;
for(int i = 0; i <= S; ++i){
for(int j = 1; j <= N; ++j){
if(0 <= i-j) dp[i][j] = dp[i-j][j]+dp[i][j-1];
else dp[i][j] = dp[i][j-1];
dp[i][j] %= mod;
}
}
//output();
cout << dp[S][N] << endl;
}
huka_huka