結果

問題 No.741 AscNumber(Easy)
ユーザー mine691mine691
提出日時 2020-03-17 23:30:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 272 ms / 2,000 ms
コード長 796 bytes
コンパイル時間 1,402 ms
コンパイル使用メモリ 164,520 KB
実行使用メモリ 81,480 KB
最終ジャッジ日時 2023-08-20 19:28:21
合計ジャッジ時間 7,940 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 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 1 ms
4,380 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 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 1 ms
4,384 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 2 ms
4,384 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 259 ms
77,888 KB
testcase_36 AC 115 ms
35,852 KB
testcase_37 AC 135 ms
41,836 KB
testcase_38 AC 133 ms
41,064 KB
testcase_39 AC 113 ms
35,200 KB
testcase_40 AC 152 ms
46,640 KB
testcase_41 AC 243 ms
71,320 KB
testcase_42 AC 126 ms
39,316 KB
testcase_43 AC 93 ms
29,344 KB
testcase_44 AC 186 ms
56,540 KB
testcase_45 AC 201 ms
60,744 KB
testcase_46 AC 250 ms
74,248 KB
testcase_47 AC 44 ms
15,316 KB
testcase_48 AC 247 ms
74,216 KB
testcase_49 AC 207 ms
62,588 KB
testcase_50 AC 30 ms
11,352 KB
testcase_51 AC 98 ms
30,664 KB
testcase_52 AC 272 ms
81,480 KB
testcase_53 AC 272 ms
81,472 KB
testcase_54 AC 270 ms
80,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#define fast() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define digit(N) cout << fixed << setprecision((N))

int dp[1000000][10][2];

int main()
{

	int N;
	cin >> N;

	dp[0][0][0] = 1;

	for (int digit = 0; digit < N; digit++)
	{
		int c = 9;

		for (int last = 0; last < 10; last++)
		{
			for (int isless = 0; isless < 2; isless++)
			{
				for (int next = 0; next < 10; next++)
				{
					if (last <= next)
						(dp[digit + 1][next][isless] += dp[digit][last][isless]) %= mod;
				}
			}
		}
	}

	int ans = 0;

	for (int i = 0; i < 10; i++)
	{
		ans += dp[N][i][0] + dp[N][i][1];
		ans %= mod;
	}

	cout << ans << "\n";
}
0