結果
| 問題 |
No.3242 Count 8 Included Numbers (Hard)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-08-22 21:08:19 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 94 ms / 2,000 ms |
| コード長 | 691 bytes |
| コンパイル時間 | 3,568 ms |
| コンパイル使用メモリ | 253,452 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-08-22 21:08:25 |
| 合計ジャッジ時間 | 5,803 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
using mint = atcoder::modint998244353;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
string s;
cin >> s;
array<array<mint, 2>,2> dp;
dp[0][1] = 1;
for(auto c : s){
int v = c - '0';
array<array<mint, 2>,2> ndp;
for(int i = 0; i < 2; i++){
for(int j = 0; j < 2; j++){
int r = j ? v : 9;
for(int k = 0; k <= r; k++){
ndp[i | (k == 8)][j & (k == r)] += dp[i][j];
}
}
}
dp = ndp;
}
cout << (dp[1][0] + dp[1][1]).val() << '\n';
}