結果
問題 |
No.2867 NOT FOUND 404 Again
|
ユーザー |
|
提出日時 | 2024-08-30 22:27:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 847 bytes |
コンパイル時間 | 3,749 ms |
コンパイル使用メモリ | 256,320 KB |
最終ジャッジ日時 | 2025-02-24 03:10:05 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | WA * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using mint = modint998244353; int ky[] = {4, 0, 4}; int main () { string s; cin >> s; int N = s.size(); std::vector<int> A; for (auto& a : s) { A.push_back(a - '0'); } vector dp(2, vector(3, mint(0))); dp[0][0] = 1; for (auto& a : A) { vector dp2(2, vector(4, mint(0))); for (int m = 0; m < 2; m ++) { for (int d = 0; d <= (m ? 9 : a); d ++) { for (int s = 0; s < 3; s ++) { if (d == ky[s]) { dp2[m || (d < a)][s + 1] += dp[m][s]; } else { dp2[m || (d < a)][0] += dp[m][s]; } } } } for (int i = 0; i < 2; i ++) { for (int j = 0; j < 3; j ++) { dp[i][j] = dp2[i][j]; } } } mint ans = 0; for (auto& a : dp) { for (auto& b : a) { ans += b; } } cout << ans.val() << endl; }