結果

問題 No.1011 Infinite Stairs
ユーザー hanbei_dayohanbei_dayo
提出日時 2020-03-26 02:57:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 337 ms / 2,000 ms
コード長 760 bytes
コンパイル時間 642 ms
コンパイル使用メモリ 81,984 KB
実行使用メモリ 427,464 KB
最終ジャッジ日時 2023-09-24 11:10:07
合計ジャッジ時間 4,767 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,484 KB
testcase_01 AC 3 ms
9,576 KB
testcase_02 AC 58 ms
198,744 KB
testcase_03 AC 263 ms
365,036 KB
testcase_04 AC 337 ms
427,228 KB
testcase_05 AC 316 ms
427,464 KB
testcase_06 AC 3 ms
7,616 KB
testcase_07 AC 71 ms
159,196 KB
testcase_08 AC 2 ms
7,404 KB
testcase_09 AC 3 ms
9,504 KB
testcase_10 AC 28 ms
67,156 KB
testcase_11 AC 189 ms
331,000 KB
testcase_12 AC 20 ms
61,696 KB
testcase_13 AC 102 ms
176,428 KB
testcase_14 AC 23 ms
74,680 KB
testcase_15 AC 93 ms
208,712 KB
testcase_16 AC 239 ms
373,492 KB
testcase_17 AC 255 ms
392,696 KB
testcase_18 AC 140 ms
247,996 KB
testcase_19 AC 11 ms
43,324 KB
testcase_20 AC 21 ms
51,356 KB
testcase_21 AC 82 ms
155,148 KB
testcase_22 AC 215 ms
333,448 KB
testcase_23 AC 77 ms
138,092 KB
testcase_24 AC 84 ms
168,836 KB
testcase_25 AC 148 ms
276,016 KB
testcase_26 AC 44 ms
94,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;
 

int  A(int x){
    if(x>=0)return x;
    else return -x;
}

ll dp[302][90010];
ll sum[302][90010];

int main(void){
    ll n,d,k;
    cin>>n>>d>>k;
    dp[0][0]=1;
    for(ll i=0;i<n;i++){
        for(ll j=0;j<d*n;j++){
            sum[i][j+1] = (sum[i][j]+dp[i][j])%N;
        }
        for(ll j=1;j<=d*n;j++){
            dp[i+1][j] = (sum[i][j]-sum[i][j-min(j,d)]+N)%N;
        }
    }
    cout<<(dp[n][k]+N)%N<<endl;
    return 0;
}
0