P26483 [AtCoder] Banned X
省选
题目描述

Problem Description

Find the number of sequences of length $ N $ consisting only of the digits $ 0, 1, 2 $ such that no contiguous subsequence has a sum exactly equal to $ X $, modulo $ 998244353 $.

Input Format

The input is given from the standard input in the following format:

$ N $ $ X $

Output Format

Output the number of sequences satisfying the condition, modulo $ 998244353 $.

Sample Input and Output

Sample Input #1

3 3

Sample Output #1

14

Sample Input #2

8 6

Sample Output #2

1179

Sample Input #3

10 1

Sample Output #3

1024

Sample Input #4

9 13

Sample Output #4

18402

Sample Input #5

314 159

Sample Output #5

459765451

Notes/Hints

Constraints

  • $1 \leq N \leq 3000$
  • $1 \leq X \leq 2N$
  • $ N, X $ are integers

Sample Explanation 1

The $ 14 $ sequences that satisfy the condition are: $ (0,0,0),(0,0,1),(0,0,2),(0,1,0),(0,1,1),(0,2,0),(0,2,2),(1,0,0),(1,0,1),(1,1,0),(2,0,0),(2,0,2),(2,2,0),(2,2,2) $.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 3
样例输出
14