結果
問題 | No.1964 sum = length |
ユーザー |
![]() |
提出日時 | 2022-06-06 14:41:53 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 800 bytes |
コンパイル時間 | 982 ms |
コンパイル使用メモリ | 138,336 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-21 04:38:49 |
合計ジャッジ時間 | 2,994 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 WA * 29 |
ソースコード
#include <cassert>#include <cmath>#include <algorithm>#include <iostream>#include <iomanip>#include <climits>#include <map>#include <queue>#include <set>#include <cstring>#include <vector>using namespace std;typedef long long ll;ll MOD = 998244353;int main() {int N;cin >> N;int L = 2 * N - 1;ll dp[N + 1][L + 1];memset(dp, 0, sizeof(dp));dp[0][0] = 1;int C[L + 1];memset(C, 0, sizeof(C));for (int i = 1; i <= L; ++i) {int v = i - i / 10;C[v]++;}for (int i = 0; i < N; ++i) {for (int j = 0; j <= L; ++j) {for (int k = 1; k <= L; ++k) {int nj = j + k;if (nj > L) continue;dp[i + 1][nj] += dp[i][j] * C[k];dp[i + 1][nj] %= MOD;}}}cout << dp[N][L] << endl;return 0;}