結果

問題 No.741 AscNumber(Easy)
ユーザー snrnsidysnrnsidy
提出日時 2021-07-01 10:18:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 148 ms / 2,000 ms
コード長 583 bytes
コンパイル時間 1,912 ms
コンパイル使用メモリ 198,852 KB
実行使用メモリ 81,516 KB
最終ジャッジ日時 2023-09-10 07:59:49
合計ジャッジ時間 6,578 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 142 ms
79,108 KB
testcase_36 AC 62 ms
36,072 KB
testcase_37 AC 74 ms
42,360 KB
testcase_38 AC 73 ms
42,328 KB
testcase_39 AC 61 ms
36,380 KB
testcase_40 AC 83 ms
48,632 KB
testcase_41 AC 125 ms
72,940 KB
testcase_42 AC 67 ms
40,192 KB
testcase_43 AC 52 ms
30,012 KB
testcase_44 AC 100 ms
56,580 KB
testcase_45 AC 108 ms
62,760 KB
testcase_46 AC 133 ms
75,012 KB
testcase_47 AC 25 ms
15,800 KB
testcase_48 AC 133 ms
74,984 KB
testcase_49 AC 115 ms
63,008 KB
testcase_50 AC 18 ms
11,532 KB
testcase_51 AC 54 ms
32,004 KB
testcase_52 AC 148 ms
81,468 KB
testcase_53 AC 147 ms
81,516 KB
testcase_54 AC 143 ms
81,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

const long long int MOD = 1e9 + 7;
long long int dp[1000001][10];

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	cin >> n;
	for (int i = 0; i < 10; i++)
	{
		dp[1][i] = 1;
	}

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

	long long int res = 0;

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

	cout << res << '\n';

	return 0;
}
0