結果
問題 |
No.269 見栄っ張りの募金活動
|
ユーザー |
![]() |
提出日時 | 2016-10-21 16:57:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 10 ms / 5,000 ms |
コード長 | 504 bytes |
コンパイル時間 | 617 ms |
コンパイル使用メモリ | 70,308 KB |
実行使用メモリ | 19,032 KB |
最終ジャッジ日時 | 2024-07-16 01:57:21 |
合計ジャッジ時間 | 1,418 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #define MOD 1000000007; using namespace std; int n, m; long long dp[101][20001]; int main() { cin.tie(0);ios::sync_with_stdio(false); int n, N, S, K;cin >> N >> S >> K; n = S - N*(N - 1) / 2 * K; m = N; dp[0][0] = 1; for (int i = 1; i <= m; i++) { for (int j = 0; j <= n;j++) { if (j - i >= 0) { dp[i][j] = (dp[i - 1][j] + dp[i][j - i]) % MOD; } else { dp[i][j] = dp[i - 1][j]; } } } cout << dp[m][n] << endl; }