結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-21 18:35:29 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 20 ms / 5,000 ms |
| コード長 | 1,067 bytes |
| コンパイル時間 | 862 ms |
| コンパイル使用メモリ | 86,736 KB |
| 実行使用メモリ | 12,160 KB |
| 最終ジャッジ日時 | 2024-12-23 07:37:37 |
| 合計ジャッジ時間 | 2,216 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
using namespace std;
typedef long long llong;
static const int max_n = 110;
static const int max_s = 20010;
static const int mod = 1000000007;
// static const int max_v = 10000000;
// vector<int> num_array(max_n);
vector<vector<int>> dp(max_n, vector<int>(max_s, 0));
int main(){
int N, S, K;
scanf("%d %d %d", &N, &S, &K);
dp[0][0] = 1;
// dp[1][0] = 1;/
for(int i=0;i<N;i++){
for(int j=0;j<=S;j++){
// printf("i=%d, j=%d, N-j+1=%d\n", i, j, N-i+1);
if(j>=(N-i)){
dp[i][j] = (dp[i][j] + dp[i][j-(N-i)]) % mod;
// printf("yes, dp[%d][%d]=%d\n", i, j, dp[i][j]);
}
if(j>=K*(N-i) && i >= 1){
dp[i][j] = (dp[i][j] + dp[i-1][j-K*(N-i)]) % mod;
// printf("no, dp[%d][%d]=%d\n", i, j, dp[i][j]);
}
}
}
printf("%d\n", dp[N-1][S]);
}