結果
| 問題 |
No.2791 Beginner Contest
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-21 22:17:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 466 bytes |
| コンパイル時間 | 1,631 ms |
| コンパイル使用メモリ | 175,836 KB |
| 実行使用メモリ | 13,756 KB |
| 最終ジャッジ日時 | 2024-06-21 22:17:52 |
| 合計ジャッジ時間 | 5,281 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 TLE * 1 |
| other | -- * 17 |
ソースコード
#include <bits/stdc++.h>
#define f(a,b,c) for(int a = b;a < c; a++)
#define max(a,b) (a) > (b) ? (a) : (b)
#define min(a,b) (a) < (b) ? (a) : (b)
std::map<std::pair<int,int>,int> d;
int next(int n, int k){
if(d.count({n,k}) != 0){
return d[{n,k}];
}
if(n <= 0){
return 1;
}
int ans = 1;
f(i,k,n+1){
ans += next(n-i,k)%998244353;
}
d[{n,k}] = ans;
return ans;
}
int main(){
int n,k;
std::cin >> n >> k;
std::cout << next(n,k);
}