QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 2048 MB مجموع النقاط: 100

#14443. Mingle

الإحصائيات

あなたと友人は、人気のある子供の遊び「Mingle」をしています。

Mingleというゲームでは、$n$ 人のプレイヤーが、円形アリーナの中央にある回転する円形プラットフォームの上に立ってスタートします。各プレイヤーには $1$ から $n$ までの固有の番号が割り当てられており、アリーナの周囲には同じく $1$ から $n$ までの固有の番号が振られた $n$ 個の部屋があります。部屋は番号順に並んでおり、部屋 $n$ は部屋 $1$ と隣接しています。

楽しい音楽が数秒間流れ、音楽が止まると円形プラットフォームの回転も止まり、全員が部屋に駆け込まなければなりません。最初、各プレイヤーは自分の番号と同じ番号の部屋を目指しますが、回転のせいで全員が方向感覚を失っています。その結果、プレイヤー $i$ は別の部屋に入ってしまう可能性があります。注目すべき点として、プレイヤーには「方向感覚の喪失係数」$k$ があり、これは全プレイヤー共通です。プレイヤー $i$ は、本来目指すべき部屋から最大で $k$ 部屋離れた部屋に入ってしまう可能性があります。候補となる $2k + 1$ 個の部屋は、各プレイヤーにとって等確率であり、すべてのプレイヤーは独立して部屋を選択します。ある部屋に一人だけで入ったプレイヤーは、その部屋の番号が自分の番号と同じでなくても、そのラウンドのMingleの勝者となります。

Mingleの1ラウンドにおける勝者の期待値を計算してください。

入力

入力は1行のみで、2つの整数 $n$ ($3 \le n \le 456$) と $k$ ($1 \le k \le \frac{n-1}{2}$) が与えられます。ここで $n$ はプレイヤーの人数、$k$ はプレイヤーの方向感覚の喪失係数です。

出力

Mingleの1ラウンドにおける勝者の期待値を $w$ とします。$w$ は互いに素な正の整数 $a, b$ を用いて $\frac{a}{b}$ と書けることが示せます。$ab^{-1} \pmod{998244353}$ を出力してください。

入出力例

入力 1

3 1

出力 1

332748119

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.