CF1051D.Bicolorings
普及+/提高
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given a grid, consisting of 2 rows and n columns. Each cell of this grid should be colored either black or white.
Two cells are considered neighbours if they have a common border and share the same color. Two cells A and B belong to the same component if they are neighbours, or if there is a neighbour of A that belongs to the same component with B.
Let's call some bicoloring beautiful if it has exactly k components.
Count the number of beautiful bicolorings. The number can be big enough, so print the answer modulo 998244353.
给你一个由 2 行 n 列组成的网格。该网格的每个格子需被染成黑色或白色。
若两个格子拥有公共边且颜色相同,则称它们为相邻。若两个格子 A 和 B 相邻,或存在 A 的某个相邻格子与 B 属于同一连通块,则称 A 和 B 属于同一连通块。
若某种双色染色方案恰好形成 k 个连通块,则称其为优美的(beautiful)。
请计算优美的双色染色方案总数。答案可能很大,请对 998244353 取模后输出。
输入格式
The only line contains two integers n and k (1≤n≤1000, 1≤k≤2n) — the number of columns in a grid and the number of components required.
唯一一行包含两个整数 n 和 k(1≤n≤1000,1≤k≤2n)—— 分别表示网格的列数和所需的连通块数量。
输出格式
Print a single integer — the number of beautiful bicolorings modulo 998244353.
输出一个整数——美丽双色染色方案的数量对 998244353 取模的结果。
输入输出样例
输入#1
3 4
输出#1
12
输入#2
4 1
输出#2
2
输入#3
1 2
输出#3
2
说明/提示
One of possible bicolorings in sample 1:

样例 1 中的一种可能的双色染色方案:

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