結果
| 問題 |
No.1964 sum = length
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-10-03 23:01:49 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 903 bytes |
| コンパイル時間 | 1,969 ms |
| コンパイル使用メモリ | 112,336 KB |
| 実行使用メモリ | 27,724 KB |
| 最終ジャッジ日時 | 2024-07-26 14:13:53 |
| 合計ジャッジ時間 | 4,103 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 8 WA * 32 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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]);
}
}