結果
問題 |
No.269 見栄っ張りの募金活動
|
ユーザー |
|
提出日時 | 2023-09-21 21:42:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 518 bytes |
コンパイル時間 | 1,705 ms |
コンパイル使用メモリ | 170,164 KB |
実行使用メモリ | 11,136 KB |
最終ジャッジ日時 | 2024-07-07 14:56:26 |
合計ジャッジ時間 | 2,239 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 10 WA * 12 |
ソースコード
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; int main(){ int n,s,k; cin >> n >> s >> k; s -= k * n * (n - 1) / 2; if (s < 0){ cout << 0 << endl; } else { vector<vector<int>> dp(n + 1, vector<int>(s + 1)); dp[0][0] = 1; for (int i = 1; i <= n; i++){ for (int j = 0; j <= s; j++){ if (j - i >= 0) dp[i][j] = dp[i - 1][j] + dp[i][j - i]; else dp[i][j] = dp[i - 1][j]; } } cout << dp[n][s] << endl; } }