結果

問題 No.1011 Infinite Stairs
ユーザー shop_one
提出日時 2020-03-21 18:48:22
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 763 bytes
コンパイル時間 1,228 ms
コンパイル使用メモリ 96,400 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-23 08:06:55
合計ジャッジ時間 4,027 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 8 RE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define MOD 1000000007
#define MAX 10000
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll n,d,k;
  vector<ll> dp(MAX,0);
  cin >> n >> d >> k;
  dp[0] = 1;
  for(int i=0;i<n;i++){
    for(int j=1;j<MAX;j++){
      dp[j] += dp[j-1];
      dp[j] %= MOD;
    }
  }
  for(int i=0;i<n;i++){
    vector<ll> cdp(dp.begin(),dp.end());
    for(int i=d;i<MAX;i++){
      cdp[i] = (cdp[i]-dp[i-d]+MOD)%MOD;
    }
    dp = cdp;
  }
  cout << dp[k-n]<<endl;
}
0