結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー |
![]() |
提出日時 | 2020-07-30 14:33:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,173 bytes |
コンパイル時間 | 1,558 ms |
コンパイル使用メモリ | 173,008 KB |
実行使用メモリ | 19,584 KB |
最終ジャッジ日時 | 2024-07-04 00:53:34 |
合計ジャッジ時間 | 2,576 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 10 WA * 12 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;using Field = vector<vector<ll>>;using Graph = vector<vector<ll>>;using VI = vector<int>;using VL = vector<ll>;using VVL = vector<vector<ll>>;using VC = vector<char>;using PI = pair<int, int>;#define FOR(i, s, n) for (int i = s; i < (n); i++)#define REP(i, n) for (int i = 0; i < (n); i++)#define ALL(x) x.begin(), x.end()const long long INF = 1LL<<60;const int mod = 1000000007;template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }ll N, S, K;VVL dp;int main() {cin.tie(0);ios_base::sync_with_stdio(false);cin >> N >> S >> K;dp.assign(N+1, VL(S+1));dp[0][0] = 1;for (int i = 0; i < N; i++) {for (int j = 0; j <= S; j++) {if (i && j >= K * (N - i)) {dp[i][j] += dp[i - 1][j - K * (N - i)];}if (j >= N - i) {dp[i][j] += dp[i][j - (N - i)];}}}cout << dp[N-1][S] << endl;return 0;}