結果

問題 No.741 AscNumber(Easy)
ユーザー RTIA1227
提出日時 2018-10-05 21:36:18
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 270 ms / 2,000 ms
コード長 907 bytes
コンパイル時間 946 ms
コンパイル使用メモリ 104,320 KB
実行使用メモリ 120,448 KB
最終ジャッジ日時 2024-10-12 12:55:42
合計ジャッジ時間 5,862 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 55
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>

using namespace std;

#define INF 1 << 29
#define LL long long int

LL const MOD = 1000000007;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    LL n;
    cin >> n;

    vector<vector<LL>> dp(n,vector<LL>(10,0));

    for(int i = 0; i < 10; i++){
        dp[n-1][i] = 1;
    }

    for(int i = n-2; i >= 0; i--){
        for(int j = 0; j < 10; j++){
            for(int k = 0; k <= j; k++){
                dp[i][j] += dp[i+1][k];
                dp[i][j] %= MOD;
            }
        }
    }

    LL ans = 0;
    for(int i = 0; i < 10; i++){
        ans += dp[0][i];
        ans %= MOD;
    }

    cout << ans << endl;
    
    return 0;
}
0