結果

問題 No.1964 sum = length
ユーザー 👑 kakel-sankakel-san
提出日時 2023-10-03 23:35:05
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 903 bytes
コンパイル時間 2,008 ms
コンパイル使用メモリ 67,928 KB
実行使用メモリ 22,768 KB
最終ジャッジ日時 2023-10-03 23:35:12
合計ジャッジ時間 6,674 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
18,736 KB
testcase_01 AC 54 ms
20,700 KB
testcase_02 AC 57 ms
20,768 KB
testcase_03 AC 54 ms
20,728 KB
testcase_04 AC 54 ms
20,640 KB
testcase_05 AC 53 ms
20,596 KB
testcase_06 AC 53 ms
20,688 KB
testcase_07 AC 53 ms
20,604 KB
testcase_08 AC 53 ms
22,636 KB
testcase_09 AC 54 ms
20,620 KB
testcase_10 AC 52 ms
20,664 KB
testcase_11 AC 54 ms
22,720 KB
testcase_12 AC 54 ms
20,656 KB
testcase_13 AC 55 ms
20,596 KB
testcase_14 AC 58 ms
22,736 KB
testcase_15 AC 60 ms
18,776 KB
testcase_16 AC 53 ms
20,684 KB
testcase_17 AC 54 ms
20,648 KB
testcase_18 AC 58 ms
20,676 KB
testcase_19 AC 54 ms
18,660 KB
testcase_20 AC 53 ms
20,608 KB
testcase_21 AC 53 ms
20,816 KB
testcase_22 AC 109 ms
20,684 KB
testcase_23 AC 107 ms
22,648 KB
testcase_24 AC 74 ms
20,700 KB
testcase_25 AC 81 ms
20,560 KB
testcase_26 AC 117 ms
22,696 KB
testcase_27 AC 91 ms
20,604 KB
testcase_28 AC 79 ms
22,768 KB
testcase_29 AC 102 ms
20,692 KB
testcase_30 AC 80 ms
20,752 KB
testcase_31 AC 117 ms
22,760 KB
testcase_32 AC 63 ms
20,684 KB
testcase_33 AC 63 ms
20,824 KB
testcase_34 AC 107 ms
22,732 KB
testcase_35 AC 67 ms
20,664 KB
testcase_36 AC 84 ms
22,724 KB
testcase_37 AC 97 ms
20,696 KB
testcase_38 AC 122 ms
22,588 KB
testcase_39 AC 79 ms
22,576 KB
testcase_40 AC 85 ms
22,636 KB
testcase_41 AC 112 ms
22,632 KB
testcase_42 AC 126 ms
20,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var list = new int[n + 3];
        for (var i = 1; i < list.Length; ++i) list[i] = i - i.ToString().Length;
        var mod = 998_244_353;
        var dp = new long[n + 1];
        dp[0] = 1;
        for (var i = 0; i < n; ++i)
        {
            var ndp = new long[n + 1];
            for (var j = 0; j < n; ++j) for (var k = 1; k < list.Length; ++k)
                if (j + list[k] < ndp.Length) ndp[j + list[k]] = (ndp[j + list[k]] + dp[j]) % mod;
            dp = ndp;
        }
        WriteLine(dp[n - 1]);
    }
}
0