結果

問題 No.2867 NOT FOUND 404 Again
コンテスト
ユーザー vjudge1
提出日時 2024-09-12 22:06:37
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
MLE  
実行時間 -
コード長 1,051 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,383 ms
コンパイル使用メモリ 333,500 KB
実行使用メモリ 1,307,456 KB
最終ジャッジ日時 2026-04-04 01:56:23
合計ジャッジ時間 8,155 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 1 MLE * 2 -- * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
#define int long long
using namespace std;
#define fi first
#define sc second
#define pii pair<int,int>
#define pb push_back
#define umap unordered_map
#define mset multiset
#define pq priority_queue
#define ull unsigned long long
#define i128 __int128
const int maxn=1e6+10;
const int mod=998244353;
string s;
int n,a[maxn],f[maxn][10][10][2];
int dfs(int x,int lst,int llst,bool flg){
    if(!x) return 1;
    if(f[x][lst][llst][flg]) return f[x][lst][llst][flg];
    int up=(flg?a[x]:9),res=0;
    for(int i=0;i<=up;i++){
        if(lst==0&&llst==4&&i==4) continue;
        res=(res+dfs(x-1,i,lst,flg&(i==a[x])))%mod; 
    }
    return f[x][lst][llst][flg]=res;
}
void solve(){
    cin>>s,n=s.size(),s=" "+s;
    for(int i=1;i<=n;i++) a[i]=(s[n-i+1]-'0');
    cout<<(dfs(n,-1,-1,1)-1+mod)%mod<<endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0;
}
/*
Samples
input:

output:

THINGS TODO:
??freopen???????
????
????????????
*/
0