結果

問題 No.2772 Appearing Even Times
ユーザー 👑 kakel-sankakel-san
提出日時 2024-06-01 00:25:30
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 1,444 ms / 4,000 ms
コード長 1,386 bytes
コンパイル時間 12,728 ms
コンパイル使用メモリ 167,832 KB
実行使用メモリ 262,652 KB
最終ジャッジ日時 2024-06-01 00:26:17
合計ジャッジ時間 31,202 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
27,776 KB
testcase_01 AC 53 ms
27,520 KB
testcase_02 AC 54 ms
27,776 KB
testcase_03 AC 53 ms
27,776 KB
testcase_04 AC 54 ms
27,384 KB
testcase_05 AC 54 ms
27,648 KB
testcase_06 AC 52 ms
27,776 KB
testcase_07 AC 50 ms
27,008 KB
testcase_08 AC 1,367 ms
108,784 KB
testcase_09 AC 1,377 ms
108,648 KB
testcase_10 AC 53 ms
27,520 KB
testcase_11 AC 52 ms
27,476 KB
testcase_12 AC 1,373 ms
108,644 KB
testcase_13 AC 1,435 ms
108,140 KB
testcase_14 AC 1,389 ms
108,256 KB
testcase_15 AC 1,377 ms
108,140 KB
testcase_16 AC 1,444 ms
108,524 KB
testcase_17 AC 1,388 ms
108,656 KB
testcase_18 AC 1,381 ms
108,648 KB
testcase_19 AC 1,384 ms
108,392 KB
testcase_20 AC 1,417 ms
107,364 KB
testcase_21 AC 1,373 ms
262,652 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (108 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

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();
    static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = ReadLine();
        var mod = 998_244_353;
        var dp = new long[n.Length][];
        for (var i = 0; i < dp.Length; ++i) dp[i] = new long[1024];
        var cur = 0;
        for (var i = 0; i < n.Length; ++i)
        {
            var ci = n[i] - '0';
            if (i == 0)
            {
                for (var j = 1; j < ci; ++j) dp[i][1 << j] = 1;
            }
            else
            {
                for (var j = 1; j < 10; ++j) ++dp[i][1 << j];
                for (var j = 0; j < ci; ++j) ++dp[i][cur ^ (1 << j)];
                for (var b = 0; b < 1024; ++b)
                {
                    for (var j = 0; j < 10; ++j)
                    {
                        dp[i][b ^ (1 << j)] = (dp[i][b ^ (1 << j)] + dp[i - 1][b]) % mod;
                    }
                }
            }
            cur ^= 1 << ci;
        }
        WriteLine(dp[^1][0] + (cur == 0 ? 1 : 0));
    }
}
0