結果

問題 No.2867 NOT FOUND 404 Again
ユーザー vwxyzvwxyz
提出日時 2024-09-07 00:25:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,050 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 35,264 KB
最終ジャッジ日時 2024-09-07 00:26:02
合計ジャッジ時間 6,170 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,880 KB
testcase_01 AC 30 ms
11,008 KB
testcase_02 AC 30 ms
10,880 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N=list(map(int,list(input())))
mod=998244353
dp=[[0]*3 for b in range(2)]
dp[1][0]=1
def next_i(i,x):
    if i==2 and x==4:
        retu=3
    elif i==1 and x==0:
        retu=2
    elif x==4:
        retu=1
    else:
        retu=0
    return retu
for i,n in enumerate(N):
    prev=dp
    dp=[[0]*3 for b in range(2)]
    for x in range(10):
        for i0 in range(3):
            i1=next_i(i0,x)
            if i1==3:
                continue
            dp[0][i1]+=prev[0][i0]
            dp[0][i1]%=mod
    if i:
        for x in range(1,10):
            i1=next_i(0,x)
            if i1==3:
                continue
            dp[0][i1]+=1
            dp[0][i1]%=mod
    for x in range(0 if i else 1,n):
        for i0 in range(3):
            i1=next_i(i0,x)
            if i1==3:
                continue
            dp[0][i1]+=prev[1][i0]
            dp[0][i1]%=mod
    for i0 in range(3):
        i1=next_i(i0,n)
        if i1==3:
            continue
        dp[1][i1]+=prev[1][i0]
        dp[1][i1]%=mod
ans=(sum(dp[0])+1)%mod
print(ans)
0