結果
| 問題 | No.269 見栄っ張りの募金活動 |
| コンテスト | |
| ユーザー |
Rayphobia12
|
| 提出日時 | 2021-04-22 01:07:17 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 712 bytes |
| 記録 | |
| コンパイル時間 | 1,857 ms |
| コンパイル使用メモリ | 179,792 KB |
| 実行使用メモリ | 1,308,160 KB |
| 最終ジャッジ日時 | 2026-03-25 14:19:52 |
| 合計ジャッジ時間 | 4,399 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | MLE * 1 -- * 2 |
| other | MLE * 1 -- * 21 |
ソースコード
#include <bits/stdc++.h>
const int nn = 20001;
const int kk = 20001;
long long dp[nn][kk];
using namespace std;
long long PF(int n, int k){
if (dp[n][k] != -1) return dp[n][k];
long long res;
// P(1,2)の様なケースが来たときは n==1のケースではなく、n-k<0のケース
if (n-k<0) return res = PF(n, n);
else if (n==1) return res = k;
else if (n==0) return res = 1;
else if (k==1) return res = 1;
else res = PF(n, k-1)+ PF(n-k, k);
return dp[n][k] = res;
}
int main(){
int N, S, K; cin >> N >> S >> K;
int n = S-N*(N-1)*K/2;
memset(dp, -1, sizeof(dp));
if (n>=0) cout << PF(n, N)<< endl;
else cout << "0" << endl;
}
Rayphobia12