#abc297f. F - Minimum Bounding Box 2

F - Minimum Bounding Box 2

Score : 500500 points

问题陈述

我们有一个 HH 行和 WW 列的网格。

在这个网格中,我们随机均匀选择 KK 个单元格。得分是包含所有选定单元格的最小矩形(其边与网格轴平行)中的单元格数量。

求得分的期望值模 998244353998244353

什么是模 998244353998244353 下的有理数?我们可以证明所求的期望值始终是一个有理数。此外,在本问题的约束条件下,当该值表示为两个互质整数 PPQQ 的形式 PQ\frac{P}{Q} 时,我们可以证明存在一个唯一的整数 RR,使得 R×QP(mod998244353)R \times Q \equiv P\pmod{998244353}0R<9982443530 \leq R < 998244353。找出这样的 RR

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

We have a grid with HH rows and WW columns.

We choose KK cells in this grid uniformly at random. The score is the number of cells in the minimum rectangle (whose edges are parallel to the axes of the grid) that contains all of the chosen cells.

Find the expected score modulo 998244353998244353.

What is rational number modulo 998244353998244353? We can prove that the sought expected value is always a rational number. Moreover, under the Constraints of this problem, when the value is represented as PQ\frac{P}{Q} by two coprime integers PP and QQ, we can prove that there is a unique integer RR such that R×QP(mod998244353)R \times Q \equiv P\pmod{998244353} and 0R<9982443530 \leq R \lt 998244353. Find such RR.

Constraints

  • 1H,W10001\leq H,W \leq 1000
  • 1KHW1\leq K \leq HW
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format:

HH WW KK

Output

Print the answer.

Sample Input 1

2 2 2

Sample Output 1

665496238

The score equals 44 in the following two cases: if cells (1,1)(1,1) and (2,2)(2,2) are chosen, or cells (1,2)(1,2) and (2,1)(2,1) are chosen. The other four cases yield a score of 22.

Thus, the expected score equals 4×2+2×46=83\frac{4 \times 2 + 2 \times 4} {6} = \frac{8}{3}. Since 665496238×38(mod998244353)665496238 \times 3 \equiv 8\pmod{998244353}, you should print 665496238665496238.

Sample Input 2

10 10 1

Sample Output 2

1

Sample Input 3

314 159 2653

Sample Output 3

639716353

update @ 2024/3/10 12:20:55