結果

問題 No.1964 sum = length
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-06-03 22:31:50
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,314 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 81,744 KB
実行使用メモリ 140,060 KB
最終ジャッジ日時 2023-10-21 02:04:59
合計ジャッジ時間 33,905 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
61,768 KB
testcase_01 AC 42 ms
59,312 KB
testcase_02 AC 89 ms
76,084 KB
testcase_03 AC 43 ms
59,312 KB
testcase_04 AC 47 ms
61,768 KB
testcase_05 AC 54 ms
63,892 KB
testcase_06 AC 61 ms
66,512 KB
testcase_07 AC 64 ms
68,836 KB
testcase_08 AC 66 ms
68,848 KB
testcase_09 AC 68 ms
68,864 KB
testcase_10 AC 69 ms
70,912 KB
testcase_11 AC 70 ms
70,924 KB
testcase_12 AC 133 ms
76,776 KB
testcase_13 AC 191 ms
77,888 KB
testcase_14 AC 301 ms
78,916 KB
testcase_15 AC 374 ms
79,560 KB
testcase_16 AC 88 ms
76,348 KB
testcase_17 AC 146 ms
76,808 KB
testcase_18 AC 164 ms
76,760 KB
testcase_19 AC 123 ms
76,396 KB
testcase_20 AC 125 ms
76,600 KB
testcase_21 AC 88 ms
76,084 KB
testcase_22 AC 1,921 ms
120,872 KB
testcase_23 AC 1,751 ms
115,892 KB
testcase_24 AC 772 ms
87,932 KB
testcase_25 AC 985 ms
94,208 KB
testcase_26 TLE -
testcase_27 AC 1,249 ms
101,436 KB
testcase_28 AC 884 ms
91,144 KB
testcase_29 AC 1,600 ms
111,080 KB
testcase_30 AC 1,001 ms
93,908 KB
testcase_31 TLE -
testcase_32 AC 457 ms
81,088 KB
testcase_33 AC 435 ms
81,348 KB
testcase_34 AC 1,811 ms
116,328 KB
testcase_35 AC 589 ms
84,272 KB
testcase_36 AC 1,092 ms
97,008 KB
testcase_37 AC 1,506 ms
106,520 KB
testcase_38 TLE -
testcase_39 AC 913 ms
90,796 KB
testcase_40 AC 999 ms
93,576 KB
testcase_41 AC 1,879 ms
121,496 KB
testcase_42 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
nn = 2 * n + 80
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