結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
togatoga
|
| 提出日時 | 2015-08-22 07:49:00 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 900 bytes |
| コンパイル時間 | 1,084 ms |
| コンパイル使用メモリ | 157,744 KB |
| 実行使用メモリ | 18,712 KB |
| 最終ジャッジ日時 | 2024-07-18 12:34:01 |
| 合計ジャッジ時間 | 7,568 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 3 TLE * 2 -- * 17 |
ソースコード
#include <bits/stdc++.h>
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
const int INF=1<<29;
const double EPS=1e-9;
const int MOD = 1000000007;
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int N,S,K;
int dp[110][20010];
int memo(int pos, int sum){
if (sum > S){
return 0;
}
if (pos == N - 1){
return 1;
}
if (dp[pos][sum] >= 0){
return dp[pos][sum];
}
int res = 0;
for (int i = 0; i*(N - pos) <= S; i++){
res += memo(pos + 1, sum + i * (N - pos));
res %= MOD;
}
return dp[pos][sum] = res;
}
int main(){
cin >> N >> S >> K;
memset(dp, -1, sizeof(dp));
S -= N * (N - 1) / 2 * K;
cout << memo(0, 0) << endl;
return 0;
}
togatoga