結果

問題 No.1964 sum = length
ユーザー 👑 kakel-sankakel-san
提出日時 2023-10-03 23:01:49
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 903 bytes
コンパイル時間 2,354 ms
コンパイル使用メモリ 65,876 KB
実行使用メモリ 24,748 KB
最終ジャッジ日時 2023-10-03 23:02:05
合計ジャッジ時間 8,813 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
18,692 KB
testcase_01 AC 55 ms
20,540 KB
testcase_02 WA -
testcase_03 AC 56 ms
20,652 KB
testcase_04 AC 54 ms
18,636 KB
testcase_05 AC 56 ms
18,636 KB
testcase_06 AC 55 ms
20,544 KB
testcase_07 AC 56 ms
20,752 KB
testcase_08 AC 55 ms
22,632 KB
testcase_09 AC 55 ms
20,676 KB
testcase_10 AC 56 ms
20,740 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

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 + 1];
        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