結果

問題 No.741 AscNumber(Easy)
コンテスト
ユーザー a
提出日時 2019-06-03 14:37:33
言語 C++14
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 88 ms / 2,000 ms
+ 893µs
コード長 499 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 907 ms
コンパイル使用メモリ 180,996 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-08-29 19:48:42
合計ジャッジ時間 4,198 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 55
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include "bits/stdc++.h"

using namespace std;

const int MOD = 1e9 + 7;

void solve(void)
{
	int n;
	cin >> n;
	vector<int> dp(10);
	dp[0] = 1;
	while (n--)
	{
		vector<int> nx(10);
		for (int i = 0; i < 10; i++)
		{
			for (int j = 0; j <= i; j++)
			{
				nx[i] += dp[j];
				nx[i] %= MOD;
			}
		}
		swap(dp, nx);
	}
	int ans = 0;
	for (int i = 0; i < 10; i++)
	{
		ans += dp[i];
		ans %= MOD;
	}
	cout << ans << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}
0