QOJ.ac

QOJ

実行時間制限: 3 s メモリ制限: 512 MB 満点: 100 難易度: [表示]

#1257. 簡單題

統計

你有一個由數字 $1$ 和 $2$ 組成的序列。每一步可以進行以下操作之一:

  1. 在所有其他 $1$ 的右側插入一個 $1$(如果沒有 $1$,則可以插入在任意位置)。
  2. 將任意一個 $2$ 改為 $1$,前提是這個 $2$ 的右側沒有 $1$。
  3. 刪除最右側的 $1$(注意,這個操作是操作 1 的逆操作)。
  4. 將最右側的 $1$ 改為 $2$(注意,這個操作是操作 2 的逆操作)。

例如,從序列 $11212122$ 出發,一步可以得到以下序列:

  • 使用操作 1:$112121122$、$112121212$、$112121221$。
  • 使用操作 2:$11212112$、$11212121$。
  • 使用操作 3:$1121222$。
  • 使用操作 4:$11212222$。

你的任務是計算:恰好使用 $t$ 次操作,將一個恰好由 $a$ 個數字 $2$ 組成的序列轉換為一個恰好由 $b$ 個數字 $2$ 組成的序列,有多少種方法。

輸入格式

輸入只有一行,包含三個整數 $a$、$b$ 和 $t$($0 \le a,b,t \le 10^6$)。

輸出格式

輸出恰好使用 $t$ 步,從由 $a$ 個數字 $2$ 組成的序列得到由 $b$ 個數字 $2$ 組成的序列的方法數。由於這個數可能非常大,請輸出它對質數 $998\,244\,353$ 取模的結果。

範例

輸入格式 1

0 0 4

輸出格式 1

3

輸入格式 2

1 4 6

輸出格式 2

60

說明

在第一個範例中,你需要用 4 步從空序列得到空序列。方法如下($\varepsilon$ 表示空序列):

$$ \varepsilon \to 1 \to \varepsilon \to 1 \to \varepsilon $$

$$ \varepsilon \to 1 \to 11 \to 1 \to \varepsilon $$

$$ \varepsilon \to 1 \to 2 \to 1 \to \varepsilon $$

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.