結果

問題 No.1011 Infinite Stairs
ユーザー simansiman
提出日時 2021-03-03 16:26:21
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 830 bytes
コンパイル時間 4,165 ms
コンパイル使用メモリ 140,384 KB
実行使用メモリ 236,404 KB
最終ジャッジ日時 2024-04-14 08:41:41
合計ジャッジ時間 6,109 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
236,088 KB
testcase_01 AC 62 ms
236,228 KB
testcase_02 AC 64 ms
236,128 KB
testcase_03 AC 146 ms
236,100 KB
testcase_04 AC 191 ms
236,080 KB
testcase_05 WA -
testcase_06 AC 63 ms
236,052 KB
testcase_07 AC 76 ms
236,096 KB
testcase_08 AC 61 ms
236,100 KB
testcase_09 AC 61 ms
236,204 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 90 ms
236,220 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 64 ms
236,024 KB
testcase_20 AC 65 ms
236,236 KB
testcase_21 AC 81 ms
236,112 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 98 ms
236,032 KB
testcase_26 AC 71 ms
236,088 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] += rui;
      if (j + D + 1 <= D * N) dp[i + 1][j + D + 1] -= rui;
    }
  }

  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