結果

問題 No.1011 Infinite Stairs
ユーザー eQeeQe
提出日時 2020-03-27 20:29:47
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 400 ms / 2,000 ms
コード長 860 bytes
コンパイル時間 1,378 ms
コンパイル使用メモリ 143,864 KB
実行使用メモリ 480,200 KB
最終ジャッジ日時 2023-09-24 11:10:23
合計ジャッジ時間 5,307 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
9,624 KB
testcase_01 AC 3 ms
11,560 KB
testcase_02 AC 58 ms
238,556 KB
testcase_03 AC 288 ms
401,736 KB
testcase_04 AC 106 ms
302,720 KB
testcase_05 AC 400 ms
480,200 KB
testcase_06 AC 2 ms
7,404 KB
testcase_07 AC 35 ms
150,832 KB
testcase_08 AC 2 ms
7,404 KB
testcase_09 AC 3 ms
9,516 KB
testcase_10 AC 18 ms
70,080 KB
testcase_11 AC 112 ms
300,364 KB
testcase_12 AC 17 ms
69,760 KB
testcase_13 AC 64 ms
165,468 KB
testcase_14 AC 20 ms
85,980 KB
testcase_15 AC 89 ms
243,824 KB
testcase_16 AC 221 ms
362,232 KB
testcase_17 AC 73 ms
276,364 KB
testcase_18 AC 142 ms
282,972 KB
testcase_19 AC 13 ms
51,556 KB
testcase_20 AC 12 ms
51,056 KB
testcase_21 AC 71 ms
165,916 KB
testcase_22 AC 136 ms
299,128 KB
testcase_23 AC 77 ms
156,696 KB
testcase_24 AC 90 ms
201,552 KB
testcase_25 AC 141 ms
303,164 KB
testcase_26 AC 39 ms
105,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <string>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) (a)=(a>b)?(a):(b);
#define chmin(a, b) (a)=(a<b)?(a):(b);
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PL;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;


/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/

ll dp[333][333*333];
ll s[333][333*333];

int main(void) {
  ll i, j, k;
  
  ll N, D, K;
  cin >> N >> D >> K;
  
  dp[0][0]=1;
  s[0][0]=1;
  for(i=0; i<N; i++) {
    for(j=1; j<=K; j++) s[i][j]=(s[i][j-1]+dp[i][j])%MOD;
    
    for(j=1; j<=K; j++) {
      if(j-D-1>=0)
        dp[i+1][j]=(s[i][j-1]-s[i][j-D-1]+MOD)%MOD;
      else
        dp[i+1][j]=(s[i][j-1]-0          +MOD)%MOD;
    }
      
  }
  
  pt(dp[N][K]);
  
}


0