QOJ.ac

QOJ

Límite de tiempo: 3 s Límite de memoria: 512 MB Puntuación total: 100 Dificultad: [mostrar]

#1257. 簡單嗰題

Estadísticas

你有一個由數字 $1$ 同 $2$ 組成嘅序列。每一步你可以:

  1. 喺所有其他 $1$ 嘅右邊某個位置插入一個 $1$(如果冇 $1$,就可以插喺任何位置)。
  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.