結果
| 問題 | No.2867 NOT FOUND 404 Again |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2024-09-12 22:06:37 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,051 bytes |
| 記録 | |
| コンパイル時間 | 3,064 ms |
| コンパイル使用メモリ | 247,476 KB |
| 実行使用メモリ | 800,980 KB |
| 最終ジャッジ日時 | 2024-09-12 22:06:47 |
| 合計ジャッジ時間 | 9,222 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 1 MLE * 1 -- * 16 |
ソースコード
#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???????
????
????????????
*/
vjudge1