#P15443. [蓝桥杯 2025 国研究生组] 黑球与白球

    ID: 17466 远端评测题 2000ms 512MiB 尝试: 0 已通过: 0 显示难度普及+/提高− 上传者: 标签>动态规划 DP数学2025组合数学逆元蓝桥杯国赛

[蓝桥杯 2025 国研究生组] 黑球与白球

Problem Description

Xiao Lan has nn white balls and mm black balls.

In each operation, Xiao Lan randomly selects 5 balls with equal probability. For the 5 selected balls, Xiao Lan dyes all of them into the color that appears most among these 5 balls. Find the probability that after kk rounds, all balls are of the same color. Output the answer modulo 998244353998244353.

Input Format

Input one line containing three non-negative integers n,m,kn, m, k, separated by one space.

Output Format

Output one line containing one integer representing the answer.

Since the answer may be in the form PQ\dfrac{P}{Q}, you need to output PQ1mod998244353P \cdot Q^{-1} \mod 998244353, where Q1Q1(mod998244353)Q^{-1} \cdot Q \equiv 1 \pmod{998244353}.

1 5 2
138645050
5 5 10
776052319

Hint

Sample Explanation 1

The answer for this sample, written as a fraction, is 3536\dfrac{35}{36}.

Constraints and Notes

For 30%30\% of the testdata, n+m10n + m \le 10, k5k \le 5.

For 60%60\% of the testdata, n+m300n + m \le 300.

For all testdata, n0n \ge 0, m0m \ge 0, 5n+m50005 \le n + m \le 5000, 1k50001 \le k \le 5000.

Translated by ChatGPT 5