結果

問題 No.1964 sum = length
ユーザー maguroflymagurofly
提出日時 2022-06-04 13:28:06
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 453 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 11,936 KB
実行使用メモリ 16,240 KB
最終ジャッジ日時 2023-10-21 02:40:02
合計ジャッジ時間 28,205 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
16,108 KB
testcase_01 AC 87 ms
16,108 KB
testcase_02 AC 89 ms
16,108 KB
testcase_03 AC 87 ms
16,108 KB
testcase_04 AC 88 ms
16,108 KB
testcase_05 AC 88 ms
16,108 KB
testcase_06 AC 88 ms
16,108 KB
testcase_07 AC 88 ms
16,104 KB
testcase_08 AC 87 ms
16,108 KB
testcase_09 AC 87 ms
16,108 KB
testcase_10 AC 88 ms
16,108 KB
testcase_11 AC 86 ms
16,108 KB
testcase_12 AC 107 ms
16,108 KB
testcase_13 AC 145 ms
16,208 KB
testcase_14 AC 224 ms
16,108 KB
testcase_15 AC 281 ms
16,108 KB
testcase_16 AC 87 ms
16,108 KB
testcase_17 AC 114 ms
16,208 KB
testcase_18 AC 127 ms
16,208 KB
testcase_19 AC 101 ms
16,108 KB
testcase_20 AC 101 ms
16,108 KB
testcase_21 AC 87 ms
16,108 KB
testcase_22 AC 1,587 ms
16,224 KB
testcase_23 AC 1,489 ms
16,224 KB
testcase_24 AC 616 ms
16,224 KB
testcase_25 AC 781 ms
16,224 KB
testcase_26 AC 1,771 ms
16,228 KB
testcase_27 AC 1,035 ms
16,224 KB
testcase_28 AC 726 ms
16,224 KB
testcase_29 AC 1,275 ms
16,224 KB
testcase_30 AC 801 ms
16,224 KB
testcase_31 AC 1,768 ms
16,224 KB
testcase_32 AC 350 ms
16,224 KB
testcase_33 AC 327 ms
16,224 KB
testcase_34 AC 1,465 ms
16,224 KB
testcase_35 AC 466 ms
16,224 KB
testcase_36 AC 894 ms
16,224 KB
testcase_37 AC 1,240 ms
16,224 KB
testcase_38 AC 1,944 ms
16,224 KB
testcase_39 AC 757 ms
16,224 KB
testcase_40 AC 812 ms
16,224 KB
testcase_41 AC 1,636 ms
16,228 KB
testcase_42 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

MOD = 998244353
n = gets.to_i

d = ->(n) {
    case n
    when 1 .. 9
        1
    when 10 .. 99
        2
    when 100 .. 999
        3
    when 1000 .. 9999
        4
    end
}

dp = [0] * n
dp[0] = 1
n.times do
    dp2 = [0] * n
    (0 ... n).each do |i|
        (1 .. 399).each do |a|
            x = a - d[a]
            break if i < x
            dp2[i] += dp[i - x]
            dp2[i] %= MOD
        end
    end
    dp = dp2
end


puts dp[n - 1]
0