結果

問題 No.1011 Infinite Stairs
ユーザー ngtkana
提出日時 2020-03-27 22:49:33
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 576 bytes
コンパイル時間 3,106 ms
コンパイル使用メモリ 194,660 KB
最終ジャッジ日時 2025-01-09 10:32:03
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 TLE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using lint=long long;
lint mod=1'000'000'007;
void add_assign(lint&x,lint y){x+=y;if(mod<=x)x-=mod;}
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint n,d,K;std::cin>>n>>d>>K;
    std::vector<lint>dp(K+1);
    dp.at(0)=1;
    while(n--){
        for(lint i=K;i>=0;i--){
            for(lint j=1;j<=d&&i+j<=K;j++){
                add_assign(dp.at(i+j),dp.at(i));
            }
            dp.at(i)=0;
        }
    }
    std::cout<<dp.at(K)<<'\n';
}
0