結果
| 問題 | No.269 見栄っ張りの募金活動 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-03-09 22:06:07 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 5,000 ms |
| コード長 | 582 bytes |
| 記録 | |
| コンパイル時間 | 1,707 ms |
| コンパイル使用メモリ | 175,496 KB |
| 実行使用メモリ | 11,264 KB |
| 最終ジャッジ日時 | 2026-03-30 17:03:51 |
| 合計ジャッジ時間 | 4,844 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int mod = 1e9 + 7;
int N, S, K;
int dp[101][20010];
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(10);
cin >> N >> S >> K;
dp[0][0] = 1;
for (int i = 1; i <= N; i++) {
for (int j = 0; j <= S; j++) {
dp[i][j] = dp[i - 1][j];
if (j - i >= 0) {
(dp[i][j] += dp[i][j - i]) %= mod;
}
}
}
int sum = S - K * N * (N - 1) / 2;
cout << (sum < 0 ? 0 : dp[N][sum]) << endl;
return 0;
}