結果
| 問題 |
No.1011 Infinite Stairs
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-20 21:39:02 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 886 bytes |
| コンパイル時間 | 1,063 ms |
| コンパイル使用メモリ | 89,228 KB |
| 実行使用メモリ | 13,768 KB |
| 最終ジャッジ日時 | 2024-12-15 04:53:38 |
| 合計ジャッジ時間 | 28,388 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 TLE * 5 |
ソースコード
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>
using namespace std;
#define int long long
#define endl "\n"
constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007;
struct fast_io {
fast_io(){
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
};
} ;
// } fio;
signed main(){
cout<<fixed<<setprecision(10);
int N, d, K;
vector<vector<int>> dp;
cin>>N>>d>>K;
dp.resize(2, vector<int>(K+1));
dp[0][0] = 1;
for(int i = 0; i < N; i++){ //cout<<i<<endl;
for(int j = 0; j < K; j++){ //cout<<j<<endl;
for(int k = 1; k <= d; k++){
if(j+k <= K){
dp[(i+1)%2][j+k] += dp[i%2][j];
dp[(i+1)%2][j+k] %= MOD;
}
}
}
for(int j = 0; j <= K; j++){
dp[i%2][j] = 0;
}
}
//cout<<"x"<<endl;
cout<<dp[(N)%2][K]<<endl;
return 0;
}