結果

問題 No.1964 sum = length
ユーザー rtyu
提出日時 2022-06-25 00:51:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 495 bytes
コンパイル時間 588 ms
コンパイル使用メモリ 66,048 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-08 19:41:13
合計ジャッジ時間 2,532 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;

const long long md = 998244353;

long long d[209][209];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	d[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < n; j++) {
			for (int k = 1; k <= n + 2; k++) {
				int t = k, pn = k;
				while (pn) {
					t--;
					pn /= 10;
				}
				if (j >= t) d[i][j] = (d[i][j] + d[i - 1][j - t]) % md;
			}
		}
	}
	cout << d[n][n - 1] << '\n';
	return 0;
}
0