結果
問題 |
No.3242 Count 8 Included Numbers (Hard)
|
ユーザー |
![]() |
提出日時 | 2025-08-22 21:18:03 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 107 ms / 2,000 ms |
コード長 | 557 bytes |
コンパイル時間 | 4,955 ms |
コンパイル使用メモリ | 335,076 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-08-22 21:18:10 |
合計ジャッジ時間 | 6,638 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using ll = long long; using mint = modint998244353; int main() { string S; cin >> S; mint ans; int L = S.size(); for(int i = 0; i < L; i++) { int d = S[i] - '0'; ans += min(d, 8) * mint(9).pow(L - i - 1); if(d == 8) { ans -= 1; break; } } mint N; for(int i = 0; i < L; i++) { int d = S[i] - '0'; N = 10 * N + d; } cout << (N - ans).val() << endl; }