結果

問題 No.1011 Infinite Stairs
ユーザー simansiman
提出日時 2021-03-03 16:27:42
言語 C++17(clang)
(14.0.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 886 bytes
コンパイル時間 1,141 ms
コンパイル使用メモリ 105,504 KB
実行使用メモリ 236,320 KB
最終ジャッジ日時 2023-07-26 19:14:51
合計ジャッジ時間 7,643 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
236,124 KB
testcase_01 AC 72 ms
236,192 KB
testcase_02 AC 77 ms
236,200 KB
testcase_03 AC 201 ms
236,288 KB
testcase_04 AC 224 ms
236,120 KB
testcase_05 WA -
testcase_06 AC 62 ms
236,172 KB
testcase_07 AC 78 ms
236,116 KB
testcase_08 AC 60 ms
236,084 KB
testcase_09 AC 60 ms
236,192 KB
testcase_10 WA -
testcase_11 AC 128 ms
236,120 KB
testcase_12 WA -
testcase_13 AC 98 ms
236,140 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 62 ms
236,180 KB
testcase_20 AC 65 ms
236,240 KB
testcase_21 AC 85 ms
236,180 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 73 ms
236,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

const ll MOD = 1000000007;
ll dp[310][310 * 310];

int main() {
  int N, D, K;
  cin >> N >> D >> K;
  memset(dp, 0, sizeof(dp));
  dp[0][1] = 1;
  dp[0][D + 1] = -1;

  for (int i = 0; i < N - 1; ++i) {
    ll sum = 0;
    ll rui = 0;

    for (int j = 0; j < D * N; ++j) {
      rui = (rui + dp[i][j]) % MOD;
      dp[i + 1][j + 1] = (dp[i + 1][j + 1] + rui) % MOD;
      if (j + D + 1 <= D * N) dp[i + 1][j + D + 1] = (dp[i + 1][j + D + 1] - rui) % MOD;
    }
  }

  ll ans = 0;
  ll rui = 0;

  for (int j = 0; j <= K; ++j) {
    rui = (rui + dp[N - 1][j]) % MOD;
    ans = (ans + rui) % MOD;
  }

  cout << rui << endl;

  return 0;
}
0