-->
当前位置:首页 > 题库

PROGRAMMING:pagoda

Luz5年前 (2021-05-10)题库471
The towering pagoda is n stories high. Today, there are several lights. Each floor of the pagoda is numbered 0-n from the first underground floor to the top floor. Except for the k-th floor, each floor has a portal, which can transport up to three floors. For example, Sasha is on the ground floor of a three story pagoda, which happens to have a portal. With this portal, Sasha can reach the first, second or third floor of the pagoda. Now Sasha is on the ground floor. How many ways does Sasha get to the top of the tower for each given n and K?
###Input format:
Multi group input
For each set of inputs, give two integers n and K in one line.
The data is guaranteed to be 1 ≤ K < n ≤$$10 ^ 6 $$.
###Output format:
For each group of input, output one line, which represents the number of schemes reaching the top layer of the tower corresponding to the input.
Results the remainder of $$998244353 $$was output.
###Input example:
Here is a set of inputs. For example:
```in
4 3
```
###Output example:
The corresponding output is given here. For example:
```out
three
```







answer:If there is no answer, please comment