思路:

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. ganglia监控自己定义metric实践

    Ganglia监控系统是UC Berkeley开源的一个项目,设计初衷就是要做好分布式集群的监控.监控层面包含资源层面和业务层面,资源层面包含cpu.memory.disk.IO.网络负载等,至于业务 ...

  2. Python开发【1.1 基础语法】

    1.Python语言特点 优点: ①.丰富的库 ②.简单.开源 ③.支持面向对象编程 ④.解释性语言,无需编译 ⑤.高层语言,不用考虑内存问题 ⑥.可移植性好,不依赖于操作系统 缺点: ①.运行效率较 ...

  3. 杭电 1150 moving tables

    http://acm.hdu.edu.cn/showproblem.php? pid=1050 Moving Tables Time Limit: 2000/1000 MS (Java/Others) ...

  4. 2016/3/18 ①PHP基础 ② PHP函数 ③其他函数(随机数、关于日期) ④正则表达式 ⑤字符串处理

    一.PHP基础 1,标记和注释 ①<?php?> ②单行注释// 多行注释/**    */2, 输出语句 ①echo输出 echo可以输出多个字符串,用逗号隔开. ②print输出 pr ...

  5. 'cmd' 不是内部或外部命令,也不是可运行的程序 或批处理文件。

    'cmd' 不是内部或外部命令,也不是可运行的程序或批处理文件. Path 添加 %SystemRoot%/system32;%SystemRoot%;%SystemRoot%/System32/Wb ...

  6. css中vertical-align和line-height的用法

    css中vertical-align和line-height的用法 1.先来看一种现象: (1).将一个图片放入一个div块中,div块背景颜色设置为aquamarine.将会发现图片与div块下边沿 ...

  7. hta+vbs+js+div+css (javascript是原生态的)

    talbe是javascript动态生成的,根据你的sql语句来的,分页是vbs用数组来造的轮子,vbs这脚本虽然强大,却没有返回数据集的东东,数组来做简单的分页还是比较简单的,批量跟新呢?是上传ex ...

  8. Django缓存系统选择之Memcached与Redis的区别与性能对比

    Django支持使用Memcached和Redis这两种流行的内存型数据库作为缓存系统.我们今天来看Memcached和Redis的区别和性能对比. redis和memcached的区别 1.Redi ...

  9. openpyxl操作excel

    [转] openpyxl库可以读写xlsx格式的文件,对于xls旧格式的文件只能用xlrd读,xlwt写来完成了. python有很多模块都是用来操作excel的,比如xlrd,xlwt,pyExce ...

  10. zoj 3866

    G - Cylinder Candy Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Su ...