結果

問題 No.1011 Infinite Stairs
ユーザー hanbei_dayo
提出日時 2020-03-26 02:57:17
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 407 ms / 2,000 ms
コード長 760 bytes
コンパイル時間 975 ms
コンパイル使用メモリ 84,020 KB
実行使用メモリ 427,144 KB
最終ジャッジ日時 2024-07-17 12:03:20
合計ジャッジ時間 4,713 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

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