QOJ.ac

QOJ

実行時間制限: 4.0 s メモリ制限: 1024 MB 満点: 100

#8173. T 瓷砖放置计数

統計

一条鲸鱼优雅地游动着,它的尾鳍浮出水面。这是一个铺砖问题。

确定用 T 型砖铺满 $H \times W$ 网格的方法数,如下图所示。计算结果对 998244353 取模。

使用 T 型砖铺满网格时,必须满足以下条件:

  • 砖块必须沿网格单元放置。
  • 砖块不得超出网格边界。
  • 不同的砖块不得覆盖同一个网格单元。
  • 不应有任何网格单元未被砖块覆盖。

此外,砖块可以旋转使用,不区分正反面,也不区分不同的砖块。此外,仅在旋转或翻转后才能重合的铺砖方案被视为不同的方案。

输入格式

输入通过标准输入给出,格式如下:

$H \ W$

  • 输入中的所有值均为整数。
  • $1 \le H \le 30$
  • $1 \le W \le 10^{18}$

输出格式

输出答案。

样例

输入 1

4 4

输出 1

2

输入 2

2 8

输出 2

0

输入 3

12 3456

输出 3

491051233

说明

在第一个样例中,用砖块铺满网格有两种可能的方法,如下所示:

在第二个样例中,没有办法用砖块铺满网格。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.