結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
61,840 KB
testcase_01 AC 44 ms
59,392 KB
testcase_02 AC 102 ms
76,516 KB
testcase_03 AC 44 ms
59,392 KB
testcase_04 AC 51 ms
61,840 KB
testcase_05 AC 65 ms
68,624 KB
testcase_06 AC 73 ms
70,732 KB
testcase_07 AC 76 ms
73,056 KB
testcase_08 AC 78 ms
73,072 KB
testcase_09 AC 79 ms
73,080 KB
testcase_10 AC 82 ms
73,644 KB
testcase_11 AC 94 ms
76,252 KB
testcase_12 AC 148 ms
76,800 KB
testcase_13 AC 222 ms
77,796 KB
testcase_14 AC 345 ms
79,508 KB
testcase_15 AC 431 ms
81,128 KB
testcase_16 AC 101 ms
76,516 KB
testcase_17 AC 167 ms
77,172 KB
testcase_18 AC 190 ms
77,920 KB
testcase_19 AC 132 ms
76,732 KB
testcase_20 AC 137 ms
76,848 KB
testcase_21 AC 99 ms
76,516 KB
testcase_22 TLE -
testcase_23 AC 1,934 ms
123,304 KB
testcase_24 AC 870 ms
90,828 KB
testcase_25 AC 1,079 ms
94,228 KB
testcase_26 TLE -
testcase_27 AC 1,519 ms
106,556 KB
testcase_28 AC 1,025 ms
95,048 KB
testcase_29 AC 1,849 ms
117,256 KB
testcase_30 AC 1,172 ms
98,012 KB
testcase_31 TLE -
testcase_32 AC 530 ms
82,148 KB
testcase_33 AC 494 ms
82,008 KB
testcase_34 TLE -
testcase_35 AC 685 ms
85,652 KB
testcase_36 AC 1,320 ms
99,208 KB
testcase_37 AC 1,772 ms
112,444 KB
testcase_38 TLE -
testcase_39 AC 1,058 ms
95,752 KB
testcase_40 AC 1,142 ms
98,992 KB
testcase_41 TLE -
testcase_42 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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