結果

問題 No.741 AscNumber(Easy)
ユーザー momotaro1303momotaro1303
提出日時 2019-09-23 22:07:24
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 235 ms / 2,000 ms
コード長 461 bytes
コンパイル時間 3,191 ms
コンパイル使用メモリ 166,528 KB
実行使用メモリ 81,704 KB
最終ジャッジ日時 2023-10-19 08:21:51
合計ジャッジ時間 6,110 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 2 ms
4,348 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 AC 2 ms
4,348 KB
testcase_34 AC 2 ms
4,348 KB
testcase_35 AC 228 ms
78,056 KB
testcase_36 AC 98 ms
36,020 KB
testcase_37 AC 114 ms
41,784 KB
testcase_38 AC 113 ms
41,232 KB
testcase_39 AC 96 ms
35,384 KB
testcase_40 AC 130 ms
46,820 KB
testcase_41 AC 202 ms
71,524 KB
testcase_42 AC 109 ms
39,552 KB
testcase_43 AC 79 ms
29,576 KB
testcase_44 AC 159 ms
56,772 KB
testcase_45 AC 171 ms
60,944 KB
testcase_46 AC 213 ms
74,416 KB
testcase_47 AC 38 ms
15,560 KB
testcase_48 AC 212 ms
74,424 KB
testcase_49 AC 177 ms
62,760 KB
testcase_50 AC 26 ms
11,596 KB
testcase_51 AC 83 ms
30,900 KB
testcase_52 AC 235 ms
81,704 KB
testcase_53 AC 235 ms
81,704 KB
testcase_54 AC 231 ms
80,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;

int N;
ll dp[1000005][10];
ll ans;

int main(){ 

cin.tie(0);
ios::sync_with_stdio(false);

cin>>N;

for(int j=1; j<=9; j++){
	dp[1][j]++;
}
for(int i=2; i<=N; i++){
	for(int j=1; j<=9; j++){
		for(int k=1; k<=j; k++){
			dp[i][j]=(dp[i][j]+dp[i-1][k])%mod;
		}
	}
}
for(int i=1; i<=N; i++){
	for(int j=1; j<=9; j++){
		ans=(ans+dp[i][j])%mod;
	}
}

cout<<ans+1<<endl;

}
0