結果

問題 No.1011 Infinite Stairs
ユーザー i_mrhji_mrhj
提出日時 2020-03-22 12:43:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,104 ms / 2,000 ms
コード長 1,132 bytes
コンパイル時間 756 ms
コンパイル使用メモリ 93,600 KB
実行使用メモリ 440,892 KB
最終ジャッジ日時 2023-09-24 11:07:30
合計ジャッジ時間 5,821 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,308 KB
testcase_01 AC 2 ms
5,652 KB
testcase_02 AC 17 ms
11,488 KB
testcase_03 AC 678 ms
306,444 KB
testcase_04 AC 117 ms
54,636 KB
testcase_05 AC 1,104 ms
440,892 KB
testcase_06 AC 2 ms
5,276 KB
testcase_07 AC 11 ms
11,540 KB
testcase_08 AC 2 ms
5,516 KB
testcase_09 AC 3 ms
6,168 KB
testcase_10 AC 10 ms
15,592 KB
testcase_11 AC 140 ms
70,880 KB
testcase_12 AC 8 ms
11,760 KB
testcase_13 AC 96 ms
81,040 KB
testcase_14 AC 4 ms
6,336 KB
testcase_15 AC 115 ms
70,828 KB
testcase_16 AC 471 ms
230,564 KB
testcase_17 AC 40 ms
23,788 KB
testcase_18 AC 281 ms
173,336 KB
testcase_19 AC 9 ms
15,784 KB
testcase_20 AC 5 ms
9,464 KB
testcase_21 AC 126 ms
111,780 KB
testcase_22 AC 231 ms
124,128 KB
testcase_23 AC 148 ms
146,696 KB
testcase_24 AC 155 ms
122,024 KB
testcase_25 AC 245 ms
130,208 KB
testcase_26 AC 60 ms
73,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;


ll powMod(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll t = powMod(x, n/2, mod);
  t = t * t % mod;
  if (n & 1) return t * x % mod;
  return t;
}

ll dp[100010][310] = {}, sum[100010][310] = {};

int main(void) {
  
  int n, d, k;
  cin >> n >> d >> k;

  
  dp[0][0] = 1;
  for (int i = 0; i <= k; i++) sum[i][0] = 1;
  for (int x = 1; x <= k; x++) {
    for (int y = 1; y <= min(n, x); y++) {
      dp[x][y] = (sum[x-1][y-1] - (x-d-1<0?0:sum[x-d-1][y-1]))%MOD;
      dp[x][y] = (dp[x][y]+MOD)%MOD;
      sum[x][y] = (sum[x-1][y]+dp[x][y])%MOD;
    }
  }
  cout << dp[k][n] << endl;

  return 0;
}
0