結果

問題 No.1011 Infinite Stairs
ユーザー shop_oneshop_one
提出日時 2020-03-21 18:48:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 763 bytes
コンパイル時間 838 ms
コンパイル使用メモリ 97,168 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-08-24 21:56:52
合計ジャッジ時間 3,113 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 19 ms
4,384 KB
testcase_03 RE -
testcase_04 AC 22 ms
4,380 KB
testcase_05 RE -
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 13 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 6 ms
4,380 KB
testcase_11 WA -
testcase_12 AC 6 ms
4,376 KB
testcase_13 WA -
testcase_14 AC 8 ms
4,380 KB
testcase_15 WA -
testcase_16 RE -
testcase_17 AC 21 ms
4,376 KB
testcase_18 RE -
testcase_19 AC 6 ms
4,380 KB
testcase_20 AC 6 ms
4,380 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 RE -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

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