結果
| 問題 | No.269 見栄っ張りの募金活動 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-25 23:39:24 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 5,000 ms |
| コード長 | 513 bytes |
| 記録 | |
| コンパイル時間 | 327 ms |
| コンパイル使用メモリ | 41,236 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-01-25 23:39:26 |
| 合計ジャッジ時間 | 1,584 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include<cstdio>
static const int MAX_N = 100;
static const int MAX_S = 20000;
static const int MOD = 1e9 + 7;
int N, S, K;
long long dp[MAX_S + 1];
int main(){
scanf("%d %d %d", &N, &S, &K);
S -= K * ((N - 1) * N / 2);
if(S >= 0){
dp[0] = 1;
for(int i = 1; i <= N; i++){
for(int j = 0; j <= S; j++){
if(j - i >= 0) dp[j] = (dp[j - i] + dp[j]) % MOD;
}
}
printf("%lld\n", dp[S]);
}else{
printf("%d\n", 0);
}
}