状态:d[i]代表n=i时的方案数。

状态转移方程:d[i]=d[i-2]+2*(d[i-2]+d[i-4]+…+d[0])

i只会为偶数,奇数情况不存在,d[0]=1

找状态转移方程的时候画图更好理解。

#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std; int d[50]; int main()
{
int n;
d[0]=1;
d[2]=3;
int sum=d[0]+d[2];
for(int i=4;i<=30;i+=2)
{
d[i]=d[i-2]+2*sum;
sum+=d[i];
}
while(cin>>n,n!=-1)
{
cout<<d[n]<<endl;
}
return 0;
}

POJ 2663 Tri Tiling dp 画图找规律的更多相关文章

  1. POJ 2663 Tri Tiling

                                                                                    Tri Tiling   Time Li ...

  2. POJ 2663 Tri Tiling 矩阵快速幂 难度:3

    Tri Tiling Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7841   Accepted: 4113 Descri ...

  3. POJ 2663 Tri Tiling 【状压DP】

    Description In how many ways can you tile a 3xn rectangle with 2x1 dominoes?  Here is a sample tilin ...

  4. poj 2663 Tri Tiling (状压dp+多米诺骨牌问题+滚动数组反思)

    本来直接一波状压dpAC的 #include<cstdio> #include<cstring> #include<algorithm> #define REP(i ...

  5. # E. Mahmoud and Ehab and the xor-MST dp/数学+找规律+xor

    E. Mahmoud and Ehab and the xor-MST dp/数学/找规律 题意 给出一个完全图的阶数n(1e18),点由0---n-1编号,边的权则为编号间的异或,问最小生成树是多少 ...

  6. 2018.09.01 poj3071Football(概率dp+二进制找规律)

    传送门 概率dp简单题. 设f[i][j]表示前i轮j获胜的概率. 如果j,k能够刚好在第i轮相遇,找规律可以发现j,k满足: (j−1)>>(i−1)" role=" ...

  7. POJ 2499 Binary Tree(二叉树,找规律)

    题意:给一个这样的二叉树,每个节点用一对数(a,b)表示,根节点为(1,1).设父亲为(a,b),左儿子(a+b,b),右儿子(a,a+b). 给几组数据,(i,j),求从根节点到(i,j)节点需要向 ...

  8. POJ 2484 A Funny Game(找规律)

    题目链接 #include<iostream> #include<cstdio> using namespace std; int main() { int n; while( ...

  9. POJ 2505 A multiplication game(找规律博弈/贪心)

    题目链接 #include<iostream> #include<cstdio> using namespace std; typedef long long ll; int ...

随机推荐

  1. https://www.jqhtml.com/30047.html strace + 命令: 这条命令十分强大,可以定位你程序到底是哪个地方出了问题

    https://www.jqhtml.com/30047.html 我的Linux手册 服务器 浏览数:72 2019-1-30 原文链接 基础安装 # CentOS sudo yum install ...

  2. Understanding User and Kernel Mode

    https://blog.codinghorror.com/understanding-user-and-kernel-mode/ Continue Discussion92 repliesJan ' ...

  3. Sql Server 课堂笔记

    创建表 --创建学生表 create table student (sno char(8) primary key, sname char(8) not null unique, ssex char( ...

  4. Lombok 插件安装和使用

    引言 以前的 Java 项目中,充斥着太多毫无技术含量的代码,比如类属性的 getter/setter/toString 方法,还有就是异常处理.I/O 流的关闭操作等.这些样板代码虽然可以通过 ID ...

  5. Java EnumMap 实现类

    EnumMap 实现类 因为 HashMap 是一种通过对 key 计算 hashCode(),通过空间换时间的方式,直接定位到 value 所在的内部数组的索引,因此,查找效率非常高. 如果作为 k ...

  6. win10 启用Hyper-V并安装Ubuntu20.10

    本文的最终目的是要将.netcore5.0(.net5.0)部署在Ubuntu中的docker容器中. 当前环境: 主系统:win10家庭版 虚拟机:Hyper-V (win10自带虚拟机) 虚拟机系 ...

  7. Kubernetes集群搭建 ver1.20.5

    目录 部署方式 1. 基础环境准备 1.1 基础初始化 1.2 安装docker 2. 部署harbor及haproxy高可用反向代理 2.1 镜像加速配置 2.2 高可用master可配置 3. 初 ...

  8. JVM-运行时数据区之PC寄存器

    1.运行时数据区图 运行时数据区是在类加载完成后所经历的阶段,当我们通过前面的:类的加载 --> 验证 --> 准备 --> 解析 --> 初始化,这几个阶段完成后,执行引擎就 ...

  9. 开源项目核心商城(CoreShop)

    帮小伙伴推一下他的开源项目作者是@大灰灰 核心商城(CoreShop)Beta 支持可视化布局的.Net小程序商城 [![star](https://gitee.com/CoreUnion/CoreS ...

  10. ADAS可行驶区域道路积水反光区域的识别算法

    ADAS可行驶区域道路积水反光区域的识别算法 Water logging area reflecting recognition algorithm for ADAS 1. 工程概要 1.1  概述: ...