結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-01 21:55:05 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 574 bytes |
| コンパイル時間 | 1,043 ms |
| コンパイル使用メモリ | 101,600 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-04-01 21:55:07 |
| 合計ジャッジ時間 | 2,054 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <iomanip>
#include <set>
#include <climits>
using namespace std;
const int p {1000000007};
int main() {
int n, s, k, dp[20001] {};
cin >> n >> s >> k;
dp[0] = 1;
s -= (n - 1) * n / 2 * k;
if (s < 0) {
cout << "0\n";
return 0;
}
for (int i = 0; i < n; ++i) {
for (int j = n - i; j <= s; ++j) {
dp[j] = (dp[j-(n-i)] + dp[j]) % p;
}
}
cout << dp[s] << '\n';
}