結果
| 問題 | No.269 見栄っ張りの募金活動 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-23 21:50:43 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 5,000 ms |
| コード長 | 620 bytes |
| 記録 | |
| コンパイル時間 | 422 ms |
| コンパイル使用メモリ | 70,848 KB |
| 実行使用メモリ | 11,520 KB |
| 最終ジャッジ日時 | 2026-01-23 21:51:04 |
| 合計ジャッジ時間 | 1,518 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include<cstdio>
#include<cmath>
#include<algorithm>
static const int MAX_N = 100;
static const int MAX_S = 20000;
static const int M = pow(10, 9) + 7;
int N, S, K;
int dp[MAX_N + 1][MAX_S + 1];
int main(){
scanf("%d %d %d", &N, &S, &K);
S -= K * ((N - 1) * N / 2);
if(S >= 0){
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][j - i] + dp[i - 1][j]) % M;
else dp[i][j] = dp[i - 1][j];
}
}
printf("%d\n", dp[N][S]);
}else{
printf("%d\n", 0);
}
}