結果

問題 No.1011 Infinite Stairs
ユーザー yakkiyakki
提出日時 2020-03-20 23:02:29
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 397 ms / 2,000 ms
コード長 979 bytes
コンパイル時間 1,029 ms
コンパイル使用メモリ 116,840 KB
実行使用メモリ 215,872 KB
最終ジャッジ日時 2023-09-24 11:02:04
合計ジャッジ時間 4,934 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 15 ms
10,548 KB
testcase_03 AC 263 ms
144,248 KB
testcase_04 AC 397 ms
215,872 KB
testcase_05 AC 397 ms
215,680 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 50 ms
28,788 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 15 ms
10,908 KB
testcase_11 AC 168 ms
92,420 KB
testcase_12 AC 9 ms
6,760 KB
testcase_13 AC 89 ms
49,832 KB
testcase_14 AC 9 ms
7,436 KB
testcase_15 AC 57 ms
33,776 KB
testcase_16 AC 276 ms
151,448 KB
testcase_17 AC 296 ms
161,956 KB
testcase_18 AC 121 ms
66,684 KB
testcase_19 AC 3 ms
4,392 KB
testcase_20 AC 13 ms
9,224 KB
testcase_21 AC 65 ms
37,448 KB
testcase_22 AC 249 ms
136,896 KB
testcase_23 AC 62 ms
35,908 KB
testcase_24 AC 59 ms
34,600 KB
testcase_25 AC 118 ms
66,332 KB
testcase_26 AC 31 ms
18,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



ll dp[310][90010];

int main(){
    int n,d,k; cin >> n >> d >> k;
    dp[0][0] = 1;
    dp[0][1] = -1;
    rep(i,n+1)rep(j,d*n+1){
        if(j >= 1){
            dp[i][j] += dp[i][j-1];
            dp[i][j] %= MOD;
        }
        dp[i+1][j+1] += dp[i][j];
        dp[i+1][j+1] %= MOD;
        dp[i+1][j+d+1] -= dp[i][j];
        if(dp[i+1][j+d+1] < 0) dp[i+1][j+d+1] += MOD;
    }
    cout << dp[n][k] << endl;

}
0