結果

問題 No.1011 Infinite Stairs
ユーザー shop_oneshop_one
提出日時 2020-03-21 18:49:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 211 ms / 2,000 ms
コード長 762 bytes
コンパイル時間 778 ms
コンパイル使用メモリ 97,468 KB
実行使用メモリ 4,684 KB
最終ジャッジ日時 2023-09-24 11:07:09
合計ジャッジ時間 4,659 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
4,684 KB
testcase_01 AC 7 ms
4,660 KB
testcase_02 AC 180 ms
4,668 KB
testcase_03 AC 197 ms
4,504 KB
testcase_04 AC 210 ms
4,656 KB
testcase_05 AC 211 ms
4,568 KB
testcase_06 AC 3 ms
4,668 KB
testcase_07 AC 108 ms
4,560 KB
testcase_08 AC 3 ms
4,560 KB
testcase_09 AC 6 ms
4,684 KB
testcase_10 AC 50 ms
4,624 KB
testcase_11 AC 186 ms
4,564 KB
testcase_12 AC 53 ms
4,556 KB
testcase_13 AC 102 ms
4,560 KB
testcase_14 AC 67 ms
4,680 KB
testcase_15 AC 153 ms
4,684 KB
testcase_16 AC 188 ms
4,512 KB
testcase_17 AC 199 ms
4,608 KB
testcase_18 AC 145 ms
4,612 KB
testcase_19 AC 40 ms
4,560 KB
testcase_20 AC 38 ms
4,564 KB
testcase_21 AC 96 ms
4,572 KB
testcase_22 AC 173 ms
4,672 KB
testcase_23 AC 84 ms
4,572 KB
testcase_24 AC 112 ms
4,568 KB
testcase_25 AC 169 ms
4,612 KB
testcase_26 AC 67 ms
4,652 KB
権限があれば一括ダウンロードができます

ソースコード

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 100000
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
vector<ll> dp(MAX,0);
signed main(){
  init_io();
  ll n,d,k;
  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