結果

問題 No.2791 Beginner Contest
ユーザー Advaith GSAdvaith GS
提出日時 2024-06-21 22:17:46
言語 C++14
(gcc 12.3.0 + boost 1.83.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
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
13,756 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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);
}
0