思路:

dp。没有像discuss中的那样优化递推式。

实现:

 class Solution
{
public:
const int MOD = 1e9 + ;
int numTilings(int N)
{
vector<vector<int>> dp(N + , vector<int>(, ));
dp[][] = ;
dp[][] = dp[][] = dp[][] = ;
for (int i = ; i <= N; i++)
{
dp[i][] = (((dp[i - ][] + dp[i - ][]) % MOD + dp[i - ][]) % MOD + dp[i - ][]) % MOD;
dp[i][] = (dp[i - ][] + dp[i - ][]) % MOD;
dp[i][] = (dp[i - ][] + dp[i - ][]) % MOD;
}
return dp[N][] % MOD;
}
};

leetcode790 Domino and Tromino Tiling的更多相关文章

  1. [Swift]LeetCode790. 多米诺和托米诺平铺 | Domino and Tromino Tiling

    We have two types of tiles: a 2x1 domino shape, and an "L" tromino shape. These shapes may ...

  2. [LeetCode] Domino and Tromino Tiling 多米诺和三格骨牌

    We have two types of tiles: a 2x1 domino shape, and an "L" tromino shape. These shapes may ...

  3. 790. Domino and Tromino Tiling

    We have two types of tiles: a 2x1 domino shape, and an "L" tromino shape. These shapes may ...

  4. 73th LeetCode Weekly Contest Domino and Tromino Tiling

    We have two types of tiles: a 2x1 domino shape, and an "L" tromino shape. These shapes may ...

  5. leetcode 790. Domino and Tromino Tiling

    We have two types of tiles: a 2x1 domino shape, and an "L" tromino shape. These shapes may ...

  6. 【LeetCode】790. Domino and Tromino Tiling 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址: https://leetcode.com/problems/domino-a ...

  7. 动态规划-填格子问题 Domino and Tromino Tiling

    2018-09-01 22:38:19 问题描述: 问题求解: 本题如果是第一看到,应该还是非常棘手的,基本没有什么思路. 不妨先从一种简化的版本来考虑.如果仅有一种砖块,那么,填充的方式如下.

  8. [LeetCode] Minimum Window Subsequence 最小窗口序列

    Given strings S and T, find the minimum (contiguous) substring W of S, so that T is a subsequence of ...

  9. Swift LeetCode 目录 | Catalog

    请点击页面左上角 -> Fork me on Github 或直接访问本项目Github地址:LeetCode Solution by Swift    说明:题目中含有$符号则为付费题目. 如 ...

随机推荐

  1. asp.net mvc3的静态化实现

    静态化处理,可以大大提高客户的访问浏览速度,提高用户体验,同时也降低了服务器本身的压力.在asp.net mvc3中,可以相对容易地处理静态化问题,不用过多考虑静态网页的同步,生成等等问题.我提供这个 ...

  2. hdu1507——Uncle Tom&#39;s Inherited Land*

    Uncle Tom's Inherited Land* Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (J ...

  3. 【MongoDB】The description of procedure in MongoDB

    In this blog the procedure of mongodb will be described in details. It is known that mongodb has pro ...

  4. Xcode 中的小技巧

    显示或隐藏欢迎页面 Command + Shift + 1 显示欢迎页 假设不想每次打开都显示,能够将上图中的勾去掉

  5. Nyquist–Shannon sampling theorem 采样定理

    Nyquist–Shannon sampling theorem - Wikipedia https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_s ...

  6. the JSON object must be str, not 'bytes'

    { "ErrorDump": "the JSON object must be str, not 'bytes'", "StatusCode" ...

  7. JSON: Circular Dependency Errors

    If you’re using Object Relational Mapping frameworks like Hibernate, and are using the bi-directiona ...

  8. 关于树论【LCA树上倍增算法】

    补了一发LCA,表示这东西表面上好像简单,但是细节真挺多. 我学的是树上倍增,倍增思想很有趣~~(爸爸的爸爸叫奶奶.偶不,爷爷)有一个跟st表非常类似的东西,f[i][j]表示j的第2^i的祖先,就是 ...

  9. 如何完成dedecms外部数据库调用|跨数据库数据调用

    第1步:打开网站include\taglib文件夹中找到sql.lib.php文件,并直接复制一些此文件出来,并把复制出来的这个文件重命名为mysql.lib.php. 注:mysql.lib.php ...

  10. 创建cordova项目

    PhoneGap是一套能让你使用HTML5轻松调用本地API接口和发布应用到商店的应用开发平台.官方说有低成本,低开发周期,轻量化等优点,这些咱暂时也没法证明,略过不表.但是有一条跨平台,却是很明显的 ...