結果

問題 No.1964 sum = length
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-06-03 22:32:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,762 ms / 2,000 ms
コード長 1,314 bytes
コンパイル時間 228 ms
コンパイル使用メモリ 81,528 KB
実行使用メモリ 125,884 KB
最終ジャッジ日時 2023-10-21 02:05:54
合計ジャッジ時間 24,614 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
61,740 KB
testcase_01 AC 38 ms
59,284 KB
testcase_02 AC 71 ms
71,048 KB
testcase_03 AC 38 ms
59,288 KB
testcase_04 AC 40 ms
61,744 KB
testcase_05 AC 47 ms
63,868 KB
testcase_06 AC 51 ms
65,956 KB
testcase_07 AC 55 ms
66,488 KB
testcase_08 AC 57 ms
66,764 KB
testcase_09 AC 61 ms
68,824 KB
testcase_10 AC 64 ms
70,892 KB
testcase_11 AC 62 ms
70,892 KB
testcase_12 AC 107 ms
76,472 KB
testcase_13 AC 145 ms
76,748 KB
testcase_14 AC 220 ms
77,796 KB
testcase_15 AC 278 ms
78,648 KB
testcase_16 AC 64 ms
71,048 KB
testcase_17 AC 120 ms
76,472 KB
testcase_18 AC 123 ms
76,736 KB
testcase_19 AC 95 ms
76,208 KB
testcase_20 AC 96 ms
76,208 KB
testcase_21 AC 63 ms
71,048 KB
testcase_22 AC 1,371 ms
109,192 KB
testcase_23 AC 1,294 ms
108,784 KB
testcase_24 AC 592 ms
84,388 KB
testcase_25 AC 725 ms
89,300 KB
testcase_26 AC 1,519 ms
114,700 KB
testcase_27 AC 906 ms
94,192 KB
testcase_28 AC 663 ms
86,488 KB
testcase_29 AC 1,114 ms
100,184 KB
testcase_30 AC 733 ms
88,824 KB
testcase_31 AC 1,546 ms
114,704 KB
testcase_32 AC 346 ms
79,280 KB
testcase_33 AC 333 ms
79,316 KB
testcase_34 AC 1,279 ms
105,824 KB
testcase_35 AC 440 ms
81,220 KB
testcase_36 AC 809 ms
89,784 KB
testcase_37 AC 1,072 ms
99,928 KB
testcase_38 AC 1,636 ms
123,596 KB
testcase_39 AC 693 ms
86,936 KB
testcase_40 AC 749 ms
89,396 KB
testcase_41 AC 1,419 ms
113,368 KB
testcase_42 AC 1,762 ms
125,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
nn = 2 * n + 50
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
if n == 1:print(1)
else:
    ans = 0
    for i in range(nn):
        ans += n_dp[i][i]
    else:print(ans%mod)
0