CF1606E.Arena
提高+/省选-
通过率:0%
时间限制:3.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There are n heroes fighting in the arena. Initially, the i-th hero has ai health points.
The fight in the arena takes place in several rounds. At the beginning of each round, each alive hero deals 1 damage to all other heroes. Hits of all heroes occur simultaneously. Heroes whose health is less than 1 at the end of the round are considered killed.
If exactly 1 hero remains alive after a certain round, then he is declared the winner. Otherwise, there is no winner.
Your task is to calculate the number of ways to choose the initial health points for each hero ai, where 1≤ai≤x, so that there is no winner of the fight. The number of ways can be very large, so print it modulo 998244353. Two ways are considered different if at least one hero has a different amount of health. For example, [1,2,1] and [2,1,1] are different.
有 n 位英雄在竞技场中战斗。初始时,第 i 位英雄的生命值为 ai。
竞技场中的战斗分为若干轮进行。每轮开始时,每位存活的英雄会对其他所有英雄各造成 1 点伤害。所有英雄的攻击同时发生。一轮结束后,生命值小于 1 的英雄被视为阵亡。
若某轮结束后恰好有 1 位英雄存活,则该英雄被宣布为获胜者;否则,本次战斗无获胜者。
你的任务是计算:有多少种方式为每位英雄指定初始生命值 ai(满足 1≤ai≤x),使得整场战斗无获胜者。答案可能非常大,请对 998244353 取模输出。若至少有一位英雄的生命值不同,则认为两种方式不同。例如,[1,2,1] 和 [2,1,1] 被视为不同的方案。
输入格式
The only line contains two integers n and x (2≤n≤500;1≤x≤500).
唯一一行包含两个整数 n 和 x(2≤n≤500;1≤x≤500)。
输出格式
Print one integer — the number of ways to choose the initial health points for each hero ai, where 1≤ai≤x, so that there is no winner of the fight, taken modulo 998244353.
输出一个整数——即为选择每位英雄的初始生命值 ai(其中 1≤ai≤x)的方式数目,使得战斗没有获胜者,结果对 998244353 取模。
输入输出样例
输入#1
2 5
输出#1
5
输入#2
3 3
输出#2
15
输入#3
5 4
输出#3
1024
输入#4
13 37
输出#4
976890680
输入解题思路,AI测评打分。不知道怎么写?