306313: CF1178C. Tiles
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Tiles
题意翻译
一种1\*1的地砖,其花纹如图所示。地砖可以任意旋转,但不能切割。 现在大鲍勃要用这种地砖铺满一间w\*h的房间,要求:对于地砖的每一条边,其两侧都应为不同的颜色(房间边界除外)。如左图是一种合法的铺法,而右图则是非法的。 请Doctor帮他求出有多少可能的铺法。 (答案对998244353取模)题目描述
Bob is decorating his kitchen, more precisely, the floor. He has found a prime candidate for the tiles he will use. They come in a simple form factor — a square tile that is diagonally split into white and black part as depicted in the figure below. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1178C/51fd9adf02d36f09b63ea5e4909ce958161fd4a1.png)The dimension of this tile is perfect for this kitchen, as he will need exactly $ w \times h $ tiles without any scraps. That is, the width of the kitchen is $ w $ tiles, and the height is $ h $ tiles. As each tile can be rotated in one of four ways, he still needs to decide on how exactly he will tile the floor. There is a single aesthetic criterion that he wants to fulfil: two adjacent tiles must not share a colour on the edge — i.e. one of the tiles must have a white colour on the shared border, and the second one must be black. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1178C/b795f3504af8553334180ece9878d04b86535357.png)The picture on the left shows one valid tiling of a $ 3 \times 2 $ kitchen. The picture on the right shows an invalid arrangement, as the bottom two tiles touch with their white parts.Find the number of possible tilings. As this number may be large, output its remainder when divided by $ 998244353 $ (a prime number).输入输出格式
输入格式
The only line contains two space separated integers $ w $ , $ h $ ( $ 1 \leq w,h \leq 1\,000 $ ) — the width and height of the kitchen, measured in tiles.
输出格式
Output a single integer $ n $ — the remainder of the number of tilings when divided by $ 998244353 $ .
输入输出样例
输入样例 #1
2 2
输出样例 #1
16
输入样例 #2
2 4
输出样例 #2
64