結果

問題 No.741 AscNumber(Easy)
ユーザー Grun1396Grun1396
提出日時 2019-03-05 07:51:41
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 187 ms / 2,000 ms
コード長 693 bytes
コンパイル時間 721 ms
コンパイル使用メモリ 73,368 KB
実行使用メモリ 81,536 KB
最終ジャッジ日時 2024-06-23 14:08:32
合計ジャッジ時間 4,520 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 55
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <string>
#include <utility>
#include <queue>
#include <string>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;
const int mod = 1e9+7;

ll dp[1000002][10];

int main(){
    int n;
    cin >> n;
    rep(i,10) dp[1][i] = 1;

    rep(i,n+1){
        rep(j,10){
            rep(k,j+1){
                dp[i+1][k] = (dp[i][j] + dp[i+1][k]) % mod;
            }
        }
    }

    ll ans = 0;
    rep(i,10){
        ans = (ans + dp[n][i]) % mod;
    }
    cout << ans << endl;

    return 0;
}
0