結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー |
![]() |
提出日時 | 2019-06-07 13:25:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,736 ms / 5,000 ms |
コード長 | 1,203 bytes |
コンパイル時間 | 807 ms |
コンパイル使用メモリ | 95,048 KB |
実行使用メモリ | 11,264 KB |
最終ジャッジ日時 | 2024-10-05 00:44:29 |
合計ジャッジ時間 | 10,062 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include<iostream> #include<cstdio> #include<cstring> #include <cstdlib> #include <math.h> #include <cmath> #include<cctype> #include<string> #include<set> #include<iomanip> #include <map> #include<algorithm> #include <functional> #include<vector> #include<climits> #include<stack> #include<queue> #include<bitset> #include <deque> #include <climits> #include <typeinfo> #include <utility> using namespace std; using ll = long long; using R = double; using Data = pair < ll, vector <ll>>; const ll MOD = 1e9 + 7; const ll inf = 1LL << 60; struct edge { ll from; ll to; ll cost; }; typedef tuple<ll, ll, ll>T; typedef pair<ll, ll>pll; #define all(x) (x).begin(),(x).end() #define rep(i,m,n) for(ll i = m;i < n;++i) #define pb push_back #define fore(i,a) for(auto &i:a) #define rrep(i,m,n) for(ll i = m;i >= n;--i) #define INF INT_MAX/2 int N, S, K; int dp[110][20202]; int main(){ cin >> N >> S >> K; dp[0][0] = 1; rep(i, 0, N - 1)rep(j,0,S+1){ for (int l = K; j+l*(i + 1) <= S; l++) { dp[i+1][j+(i+1)*l] += dp[i][j]; dp[i+1][j+(i+1)*l] %= MOD; } } ll ans = 0; for (int a1 = 0; N*a1 <= S; a1++) { ans += dp[N-1][S-N*a1]; ans %= MOD; } cout << ans % MOD << endl; return 0; }