Training, Round 3

시간 제한1초메모리 제한2048 MB

요약
n개 원소에서 무작위로 고른 p개짜리 부분집합 k개가 서로 겹치지 않을 확률을 소수 모듈러스로 구한다.
난이도

어려움10점 중 8점

유형
조합론, 확률, 수학, 정수론
정답자
아직 제출이 없습니다

문제

Ashley is training for another programming contest on Brandon's Online Judge.

Ashley has kk weeks left to train for her next programming contest. Her coach, Tom, is very busy and is no longer curating specific problems for Ashley to train on. At the start of every week, Tom picks pp distinct problems independently and uniformly at random from the bank of nn problems that Brandon's Online Judge has and assigns them for Ashley to work on. Tom generates a total of kk sets of problems in this manner.

Ashley diligently solves every problem that Tom picks out. However, she gets annoyed if there exist two different weeks that share at least one problem in common, because she wants to solve unique problems.

Compute the probability that Ashley becomes annoyed.

입력

The first and only line of input contains three integers, nn (1≤n≤107)(1 \le n \le 10^7), kk (1≤k≤107)(1 \le k \le 10^7), and pp (1≤p≤n)(1 \le p \le n).

출력

Let pp be the probability that Ashley becomes annoyed. It can be shown that pp can be written as a rational number xy\frac{x}{y} with gcd⁡(x,y)=1\gcd(x, y) = 1 and y≢0(mod998244353)y \not\equiv 0 \pmod{998244353}. Define rr to be the unique integer in \[0,998244353)\[0, 998244353) such that r⋅y≡x(mod998244353)r \cdot y \equiv x \pmod{998244353}. Output rr.

It can be shown that, under the constraints provided, rr is guaranteed to exist and also be unique.

힌트

In the first sample, we can show that the probability Ashley becomes annoyed is 79\frac{7}{9}. Note that 110916040⋅9≡7(mod998244353)110916040 \cdot 9 \equiv 7 \pmod {998244353}, therefore the output for that test case is 110916040110916040.

In the second sample, we can show that Ashley always becomes annoyed. Note that 1⋅1≡1(mod998244353)1 \cdot 1 \equiv 1 \pmod {998244353}, therefore the output for that test case is 11.

In the third sample, we can show that Ashley never becomes annoyed. Note that 0⋅1≡0(mod998244353)0 \cdot 1 \equiv 0 \pmod {998244353}, therefore the output for that test case is 00.

예제3

  1. 예제 1

    입력
    3 3 1
    
    예상 출력
    110916040
    
  2. 예제 2

    입력
    3 2 2
    
    예상 출력
    1
    
  3. 예제 3

    입력
    3 1 1
    
    예상 출력
    0