結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 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 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 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,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 260 ms
77,856 KB
testcase_36 AC 118 ms
35,788 KB
testcase_37 AC 137 ms
41,612 KB
testcase_38 AC 132 ms
41,188 KB
testcase_39 AC 110 ms
35,212 KB
testcase_40 AC 152 ms
46,576 KB
testcase_41 AC 237 ms
71,500 KB
testcase_42 AC 131 ms
39,444 KB
testcase_43 AC 93 ms
29,392 KB
testcase_44 AC 188 ms
56,588 KB
testcase_45 AC 201 ms
60,704 KB
testcase_46 AC 250 ms
74,180 KB
testcase_47 AC 43 ms
15,364 KB
testcase_48 AC 249 ms
74,192 KB
testcase_49 AC 208 ms
62,524 KB
testcase_50 AC 29 ms
11,556 KB
testcase_51 AC 97 ms
30,812 KB
testcase_52 AC 276 ms
81,484 KB
testcase_53 AC 273 ms
81,604 KB
testcase_54 AC 271 ms
80,732 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++)
	{
		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