結果

問題 No.1964 sum = length
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-06-03 22:28:12
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,292 bytes
コンパイル時間 1,053 ms
コンパイル使用メモリ 81,712 KB
実行使用メモリ 111,548 KB
最終ジャッジ日時 2023-10-21 02:02:38
合計ジャッジ時間 20,708 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,316 KB
testcase_01 RE -
testcase_02 AC 65 ms
68,856 KB
testcase_03 RE -
testcase_04 AC 37 ms
53,376 KB
testcase_05 AC 37 ms
53,376 KB
testcase_06 AC 38 ms
53,376 KB
testcase_07 AC 45 ms
61,820 KB
testcase_08 AC 48 ms
61,856 KB
testcase_09 AC 51 ms
61,852 KB
testcase_10 AC 49 ms
63,900 KB
testcase_11 AC 48 ms
63,900 KB
testcase_12 AC 76 ms
74,504 KB
testcase_13 AC 120 ms
76,540 KB
testcase_14 AC 173 ms
77,324 KB
testcase_15 WA -
testcase_16 AC 63 ms
68,912 KB
testcase_17 AC 96 ms
76,132 KB
testcase_18 AC 105 ms
76,276 KB
testcase_19 AC 71 ms
73,180 KB
testcase_20 AC 73 ms
73,576 KB
testcase_21 AC 64 ms
68,912 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
nn = 2 * n + 10
dp = [[0] * (nn) for _ in range(nn)]
for i in range(nn-1):
    dp[i+1][len(str(i+1))] += 1
for j in range(1,nn):
        for i in range(1,nn):
            dp[i][j] += dp[i-1][j]
mod = 998244353 
for w in range(n-1):
    n_dp = [[0] * (nn) for _ in range(nn)]
    for i in range(1,nn):
        for j in range(1,nn):
            if j >= 2:
                if i - 10 < 0:
                    n_dp[i][j] += dp[i-1][j-2]
                else:
                    n_dp[i][j] += dp[i-1][j-2] - dp[i-10][j-2]
            if j >= 3 and i - 10 >= 0:
                if i - 100 < 0:
                    n_dp[i][j] += dp[i-10][j-3]
                else:
                    n_dp[i][j] += dp[i-10][j-3] - dp[i-100][j-3]
            if j >= 4 and i - 100 >= 0:
                if i - 1000 < 0:
                    n_dp[i][j] += dp[i-100][j-4]
                else:
                    n_dp[i][j] += dp[i-100][j-4] - dp[i-1000][j-4]
            n_dp[i][j] %= mod
#     for e in dp:
#         print(e)
#     print()
#     for e in n_dp:
#         print(e)
    if w == n-2:break
    for j in range(1,nn):
        for i in range(1,nn):
            n_dp[i][j] += n_dp[i-1][j]
    dp = n_dp
ans = 0
for i in range(nn):
    ans += n_dp[i][i]
if n == 1:print(1)
else:print(ans%mod)
0