CF1278F.Cards

省选/NOI-

通过率:0%

时间限制:4.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Consider the following experiment. You have a deck of mm cards, and exactly one card is a joker. nn times, you do the following: shuffle the deck, take the top card of the deck, look at it and return it into the deck.

Let xx be the number of times you have taken the joker out of the deck during this experiment. Assuming that every time you shuffle the deck, all m!m! possible permutations of cards are equiprobable, what is the expected value of xkx^k? Print the answer modulo 998244353998244353.

考虑以下实验:你有一副 mm 张牌的牌堆,其中恰好有一张是王牌(joker)。重复进行 nn 次如下操作:洗牌,取出牌堆最上方的一张牌,查看其花色后将其放回牌堆。

设 xx 为该实验中取出王牌的次数。假设每次洗牌时,所有 m!m! 种可能的牌序排列都是等概率的,求 xkx^k 的期望值。请输出答案对 998244353998244353 取模的结果。

输入格式

The only line contains three integers nn, mm and kk (1≤n,m<9982443531 \le n, m \lt 998244353, 1≤k≤50001 \le k \le 5000).

唯一的一行包含三个整数 nn、mm 和 kk(1≤n,m<9982443531 \le n, m \lt 998244353,1≤k≤50001 \le k \le 5000)。

输出格式

Print one integer — the expected value of xkx^k, taken modulo 998244353998244353 (the answer can always be represented as an irreducible fraction ab\frac{a}{b}, where bmod  998244353≠0b \mod 998244353 \ne 0; you have to print a⋅b−1mod  998244353a \cdot b^{-1} \mod 998244353).

输出一个整数——xkx^k 的期望值对 998244353998244353 取模的结果(答案总可表示为既约分数 ab\frac{a}{b},其中 b mod 998244353≠0b \bmod 998244353 \ne 0;你需要输出 a⋅b−1 mod 998244353a \cdot b^{-1} \bmod 998244353)。

输入输出样例

  • 输入#1

    1 1 1

    输出#1

    1
  • 输入#2

    1 1 5000

    输出#2

    1
  • 输入#3

    2 2 2

    输出#3

    499122178
  • 输入#4

    998244352 1337 5000

    输出#4

    326459680

输入解题思路,AI测评打分。不知道怎么写?

首页