woj-server/resource/runner/problem/book/ch3/4. domino/description.md

522 B

骨牌铺法

Tags

  • C++一本通
  • 递推

Description

有$1\times n$的一个长方形,用一个$1\times 1$、$1\times 2$和$1\times 3$的骨牌铺满方格。例如当$n=3$时为$1\times 3$的方格。此时用$1\times 1$、$1\times 2$和$1\times 3$的骨牌铺满方格,共有四种铺法。如下图:

+-+-+-+   +-+-+-+   +-+-+-+   +-+-+-+
|*|*|*|   |*|---|   |---|*|   |-----|
+-+-+-+   +-+-+-+   +-+-+-+   +-+-+-+

Example Cases

Case 1

Input

3

Output

4