結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー |
![]() |
提出日時 | 2017-07-04 10:50:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 26 ms / 5,000 ms |
コード長 | 963 bytes |
コンパイル時間 | 1,733 ms |
コンパイル使用メモリ | 167,916 KB |
実行使用メモリ | 19,072 KB |
最終ジャッジ日時 | 2024-07-16 01:58:36 |
合計ジャッジ時間 | 2,550 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
// 基本テンプレート (縮小版)#include <bits/stdc++.h>using namespace std;#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)#define int long longtemplate<typename T> void chmax(T &a, T b) {a = max(a, b);}template<typename T> void chmin(T &a, T b) {a = min(a, b);}template<typename T> void chadd(T &a, T b) {a = a + b;}typedef pair<int, int> pii;typedef long long ll;constexpr ll INF = 1001001001001001LL;constexpr ll MOD = 1000000007LL;int N, S, K;int dp[101][20001];signed main() {dp[1][0] = 1;cin >> N >> S >> K;rep(i,0,N) repq(j,0,S) {if((N-i) * K <= j) (dp[i+1][j] += dp[i][j-(N-i)*K]) %= MOD;if(N-i <= j) (dp[i+1][j] += dp[i+1][j-(N-i)]) %= MOD;// if(dp[i+1][j] != 0) printf("debug: dp[%lld][%lld] = %lld\n", i+1, j, dp[i+1][j]);}cout << dp[N][S] << endl;return 0;}