結果

問題 No.1011 Infinite Stairs
コンテスト
ユーザー hanbei_dayo
提出日時 2020-03-26 02:57:17
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 309 ms / 2,000 ms
コード長 760 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 557 ms
コンパイル使用メモリ 99,860 KB
実行使用メモリ 425,600 KB
最終ジャッジ日時 2026-04-01 02:56:47
合計ジャッジ時間 3,664 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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