結果

問題 No.1011 Infinite Stairs
ユーザー rinrinta121
提出日時 2020-03-21 13:30:39
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 346 ms / 2,000 ms
コード長 825 bytes
コンパイル時間 789 ms
コンパイル使用メモリ 82,224 KB
実行使用メモリ 215,936 KB
最終ジャッジ日時 2024-07-17 11:58:57
合計ジャッジ時間 3,035 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;

ll dp[310][90400];

int main()
{
    int n,d,m;
    cin >> n >> d >> m;
    dp[0][0] = 1;
    for(int i = 0; i < n; i++){
        for(int j = 0; j <= m; j++){
            dp[i+1][j+1] += dp[i][j];
            dp[i+1][j+1] %= mod;
            dp[i+1][j+1+d] -= dp[i][j];
            dp[i+1][j+1+d] %= mod;
        }
        for(int j = 0; j <= m; j++){
            dp[i+1][j+1] += dp[i+1][j];
            dp[i][j] %= mod;

        }
    }
    cout << dp[n][m] % mod << endl;
}
0