結果

問題 No.741 AscNumber(Easy)
ユーザー rhincodon66rhincodon66
提出日時 2018-10-05 23:13:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 267 ms / 2,000 ms
コード長 606 bytes
コンパイル時間 1,695 ms
コンパイル使用メモリ 167,716 KB
実行使用メモリ 89,188 KB
最終ジャッジ日時 2024-04-20 17:28:01
合計ジャッジ時間 6,520 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 1 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 252 ms
84,992 KB
testcase_36 AC 111 ms
38,784 KB
testcase_37 AC 129 ms
45,184 KB
testcase_38 AC 130 ms
44,672 KB
testcase_39 AC 109 ms
38,084 KB
testcase_40 AC 144 ms
50,816 KB
testcase_41 AC 231 ms
78,076 KB
testcase_42 AC 123 ms
42,752 KB
testcase_43 AC 89 ms
31,872 KB
testcase_44 AC 180 ms
61,696 KB
testcase_45 AC 194 ms
66,284 KB
testcase_46 AC 237 ms
81,152 KB
testcase_47 AC 44 ms
16,384 KB
testcase_48 AC 239 ms
81,024 KB
testcase_49 AC 201 ms
68,420 KB
testcase_50 AC 30 ms
11,904 KB
testcase_51 AC 97 ms
33,152 KB
testcase_52 AC 254 ms
89,188 KB
testcase_53 AC 267 ms
89,088 KB
testcase_54 AC 263 ms
88,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
const int mod=1000000007;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;cin >> n;
	vector<vector<ll>> dp(10,vector<ll>(n+2));
	rep(i,9) dp[i+1][1]=1;
	for(int i=1;i<=n;++i){
		for(int j=1;j<=9;++j){
			for(int k=j;k<=9;++k){
				dp[j][i+1]+=dp[k][i];
				dp[j][i+1]%=mod;
			}
		}
	}
	ll ans=0;
	for(int i=1;i<=n;++i){
		for(int j=1;j<=9;++j){
			ans+=dp[j][i];
			ans%=mod;
		}
	}
	ans++;
	cout << ans << endl;
}
0