結果

問題 No.741 AscNumber(Easy)
ユーザー misora192
提出日時 2020-07-23 23:06:43
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 191 ms / 2,000 ms
コード長 652 bytes
コンパイル時間 1,958 ms
コンパイル使用メモリ 172,268 KB
実行使用メモリ 120,396 KB
最終ジャッジ日時 2024-06-23 22:06:51
合計ジャッジ時間 5,631 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 55
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

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

	ll MOD = 1e9 + 7;

	ll n;
	cin >> n;

	vector<vector<ll>> dp(n+2, vector<ll>(10, 0));
	rep(i, 9) dp[0][i+1] = 1;

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

	ll ans = 1;
	rep(i, n){
		ans += dp[i+1][9];
		ans %= MOD;
	}

	cout << ans << endl;
}
0