CF1580F.Problems for Codeforces
NOI/NOI+/CTSC
通过率:0%
时间限制:8.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
XYMXYM and CQXYM will prepare n problems for Codeforces. The difficulty of the problem i will be an integer ai, where ai≥0. The difficulty of the problems must satisfy ai+ai+1<m (1≤i<n), and a1+an<m, where m is a fixed integer. XYMXYM wants to know how many plans of the difficulty of the problems there are modulo 998244353.
Two plans of difficulty a and b are different only if there is an integer i (1≤i≤n) satisfying ai=bi.
XYMXYM 和 CQXYM 将为 Codeforces 准备 n 道题目。第 i 道题的难度为一个整数 ai,其中 ai≥0。题目的难度需满足约束条件:对所有 1≤i<n,有 ai+ai+1<m,且 a1+an<m,其中 m 是一个给定的固定整数。XYMXYM 想知道满足上述条件的难度设定方案总数,答案对 998244353 取模。
若存在某个整数 i(1≤i≤n)使得 ai=bi,则称两个难度序列 a 和 b 是不同的。
输入格式
A single line contains two integers n and m (2≤n≤50000, 1≤m≤109).
一行包含两个整数 n 和 m(2≤n≤50000,1≤m≤109)。
输出格式
Print a single integer — the number of different plans.
输出一个整数——不同方案的数量。
输入输出样例
输入#1
3 2
输出#1
4
输入#2
5 9
输出#2
8105
输入#3
21038 3942834
输出#3
338529212
说明/提示
In the first test case, the valid a are: [0,0,0], [0,0,1], [0,1,0], [1,0,0].
[1,0,1] is invalid since a1+an≥m.
在第一个测试用例中,合法的 a 有:[0,0,0]、[0,0,1]、[0,1,0]、[1,0,0]。
[1,0,1] 不合法,因为 a1+an≥m。
输入解题思路,AI测评打分。不知道怎么写?