結果

問題 No.1011 Infinite Stairs
ユーザー eQe
提出日時 2020-03-27 20:16:23
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 761 bytes
コンパイル時間 1,209 ms
コンパイル使用メモリ 155,496 KB
実行使用メモリ 467,964 KB
最終ジャッジ日時 2025-01-02 09:17:21
合計ジャッジ時間 4,272 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 3 WA * 21
権限があれば一括ダウンロードができます

ソースコード

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++)
      dp[i+1][j]=(s[i][j-1]-s[i][j-D-1]+MOD)%MOD;
  }
  
  pt(dp[N][K]);
  
}


0