CF1096E.The Top Scorer
省选/NOI-
通过率:0%
时间限制:3.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Hasan loves playing games and has recently discovered a game called TopScore. In this soccer-like game there are p players doing penalty shoot-outs. Winner is the one who scores the most. In case of ties, one of the top-scorers will be declared as the winner randomly with equal probability.
They have just finished the game and now are waiting for the result. But there's a tiny problem! The judges have lost the paper of scores! Fortunately they have calculated sum of the scores before they get lost and also for some of the players they have remembered a lower bound on how much they scored. However, the information about the bounds is private, so Hasan only got to know his bound.
According to the available data, he knows that his score is at least r and sum of the scores is s.
Thus the final state of the game can be represented in form of sequence of p integers a1,a2,…,ap (0≤ai) — player's scores. Hasan is player number 1, so a1≥r. Also a1+a2+⋯+ap=s. Two states are considered different if there exists some position i such that the value of ai differs in these states.
Once again, Hasan doesn't know the exact scores (he doesn't know his exact score as well). So he considers each of the final states to be equally probable to achieve.
Help Hasan find the probability of him winning.
It can be shown that it is in the form of QP where P and Q are non-negative integers and Q=0, P≤Q. Report the value of P⋅Q−1(mod998244353).
哈桑热爱玩游戏,最近他发现了一款名为“TopScore”的类似足球的游戏。在这款点球大战游戏中,共有 p 名玩家参与。得分最高的玩家获胜;若出现并列最高分,则所有并列者将被等概率随机地选为胜者。
游戏刚刚结束,众人正等待结果公布。但出现了一个小问题:裁判们遗失了记录每位玩家得分的纸张!幸运的是,他们在丢失前已计算出所有玩家得分的总和,并且对其中部分玩家还记得其得分的下界。然而,这些下界信息属于隐私,因此哈桑仅得知了自己的得分下界。
根据现有数据,哈桑知道自己的得分至少为 r,且所有玩家得分之和为 s。
因此,游戏的最终状态可表示为一个长度为 p 的非负整数序列 a1,a2,…,ap(即各位玩家的得分),满足 0≤ai。哈桑是 1 号玩家,故有 a1≥r;同时满足 a1+a2+⋯+ap=s。若存在某个位置 i 使得两个序列在该位置上的值不同,则认为这两个状态不同。
再次强调,哈桑并不知道确切的得分(甚至不知道自己的精确得分)。因此,他将每一种可能的最终状态视为等概率发生。
请帮助哈桑计算他获胜的概率。
可以证明,该概率可表示为最简分数形式 QP,其中 P 和 Q 是非负整数,Q=0,且 P≤Q。请输出 P⋅Q−1mod998244353 的值。
输入格式
The only line contains three integers p, s and r (1≤p≤100, 0≤r≤s≤5000) — the number of players, the sum of scores of all players and Hasan's score, respectively.
唯一的一行包含三个整数 p、s 和 r(1≤p≤100,0≤r≤s≤5000),分别表示玩家人数、所有玩家的得分总和以及哈桑的得分。
输出格式
Print a single integer — the probability of Hasan winning.
It can be shown that it is in the form of QP where P and Q are non-negative integers and Q=0, P≤Q. Report the value of P⋅Q−1(mod998244353).
输出一个整数——即哈桑获胜的概率。
可以证明该概率可表示为 QP 的形式,其中 P 和 Q 为非负整数,且 Q=0,P≤Q。请输出 P⋅Q−1(mod998244353) 的值。
输入输出样例
输入#1
2 6 3
输出#1
124780545
输入#2
5 20 11
输出#2
1
输入#3
10 30 10
输出#3
85932500
说明/提示
In the first example Hasan can score 3, 4, 5 or 6 goals. If he scores 4 goals or more than he scores strictly more than his only opponent. If he scores 3 then his opponent also scores 3 and Hasan has a probability of 21 to win the game. Thus, overall he has the probability of 87 to win.
In the second example even Hasan's lower bound on goal implies him scoring more than any of his opponents. Thus, the resulting probability is 1.
在第一个例子中,哈桑可以打进 3、4、5 或 6 个进球。若他打进 4 个或更多进球,则他的进球数严格多于其唯一对手。若他仅打进 3 个进球,则其对手也打进 3 个进球,此时哈桑赢得比赛的概率为 21。因此,他赢得比赛的总概率为 87。
在第二个例子中,即使取哈桑进球数的下界,他也必然比所有对手进球数都多。因此,最终获胜概率为 1。
输入解题思路,AI测评打分。不知道怎么写?