結果
問題 |
No.1011 Infinite Stairs
|
ユーザー |
![]() |
提出日時 | 2020-03-22 05:10:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 236 ms / 2,000 ms |
コード長 | 620 bytes |
コンパイル時間 | 1,636 ms |
コンパイル使用メモリ | 169,700 KB |
実行使用メモリ | 215,016 KB |
最終ジャッジ日時 | 2024-07-17 12:00:35 |
合計ジャッジ時間 | 3,709 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
// AtCoder template // sabaより胡蝶しのぶさんの方が可愛いのではないか? #include<bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for(int i = 0; i < n; ++i) ll dp[301][90001]; int main(){ cin.tie(0); ios::sync_with_stdio(false); const ll MOD = 1e9 + 7; int n,d,k; cin >> n >> d >> k; dp[0][0] = 1LL; rep(i,n){ // i回目の行動 vector<ll> dpsum(k+2,0LL); rep(j,k) dpsum[j+1] = (dpsum[j] + dp[i][j]) % MOD; rep(j,k) dp[i+1][j+1] = (dpsum[j+1]-dpsum[max(0,j-d+1)] + MOD) % MOD; } cout << dp[n][k] << endl; }