POJ 2663 Tri Tiling dp 画图找规律
状态: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 画图找规律的更多相关文章
- POJ 2663 Tri Tiling
Tri Tiling Time Li ...
- POJ 2663 Tri Tiling 矩阵快速幂 难度:3
Tri Tiling Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7841 Accepted: 4113 Descri ...
- POJ 2663 Tri Tiling 【状压DP】
Description In how many ways can you tile a 3xn rectangle with 2x1 dominoes? Here is a sample tilin ...
- poj 2663 Tri Tiling (状压dp+多米诺骨牌问题+滚动数组反思)
本来直接一波状压dpAC的 #include<cstdio> #include<cstring> #include<algorithm> #define REP(i ...
- # E. Mahmoud and Ehab and the xor-MST dp/数学+找规律+xor
E. Mahmoud and Ehab and the xor-MST dp/数学/找规律 题意 给出一个完全图的阶数n(1e18),点由0---n-1编号,边的权则为编号间的异或,问最小生成树是多少 ...
- 2018.09.01 poj3071Football(概率dp+二进制找规律)
传送门 概率dp简单题. 设f[i][j]表示前i轮j获胜的概率. 如果j,k能够刚好在第i轮相遇,找规律可以发现j,k满足: (j−1)>>(i−1)" role=" ...
- POJ 2499 Binary Tree(二叉树,找规律)
题意:给一个这样的二叉树,每个节点用一对数(a,b)表示,根节点为(1,1).设父亲为(a,b),左儿子(a+b,b),右儿子(a,a+b). 给几组数据,(i,j),求从根节点到(i,j)节点需要向 ...
- POJ 2484 A Funny Game(找规律)
题目链接 #include<iostream> #include<cstdio> using namespace std; int main() { int n; while( ...
- POJ 2505 A multiplication game(找规律博弈/贪心)
题目链接 #include<iostream> #include<cstdio> using namespace std; typedef long long ll; int ...
随机推荐
- Mysql数据库-多实例主从复制-主从故障详解
一.mysql结构 1.实例 1.什么是单实例 一个进程 + 多个线程 + 一个预分配的内存空间 2.多实例 多个进程 + 多个线程 + 多个预分配的内存空间 ](http://shelldon.51 ...
- 搜狗拼音输入法v9.6a (9.6.0.3568) 去广告精简优化版本
https://yxnet.net/283.html 搜狗拼音输入法v9.6a (9.6.0.3568) 去广告精简优化版本 软件大小:29.2 MB 软件语言:简体中文 软件版本:去广告版 软件授权 ...
- 高德Serverless平台建设及实践
导读 高德启动Serverless建设已经有段时间了,目前高德Serverless业务的峰值早已超过十万QPS量级,平台从0到1,QPS从零到超过十万,成为阿里集团内Serverless应用落地规模最 ...
- Spring的基础配置,以及注解
常用依赖 <dependencies> <!-- https://mvnrepository.com/artifact/org.springframework/spring-webm ...
- macOS Big Sur 11.4 (20F71) 正式版(DMG、ISO、IPSW),百度网盘下载
本站提供的 macOS Big Sur 软件包,既可以拖拽到 Applications(应用程序)下直接安装,也可以制作启动 U 盘安装,或者在虚拟机中启动安装. 请访问原文链接:https://sy ...
- VMware vSphere 7.0 Update 2 发布 - 数据中心虚拟化和 Kubernetes 云原生应用引擎
2021 年 3 月 9 日,VMware 发布了 vSphere 7 Update 2.它可以通过 VMware Customer Connect 和 vSphere Lifecycle Manag ...
- 使用BeautifulSoup高效解析网页,再也不用担心睡不着觉了
BeautifulSoup是一个可以从 HTML 或 XML 文件中提取数据的 Python 库 那需要怎么使用呢? 首先我们要安装一下这个库 1.pip install beautifulsoup4 ...
- springboot 搭配redis缓存
1.引入依赖 <dependencies> <dependency> <groupId>org.springframework.boot</groupId&g ...
- Xilinx FPGA全局介绍
Xilinx FPGA全局介绍 现场可编程门阵列 (FPGA) 具有诸多特性,无论是单独使用,抑或采用多样化架构,皆可作为宝贵的计算资产:许多设计人员并不熟悉 FPGA,亦不清楚如何将这类器件整合到设 ...
- 慢镜头变焦:视频超分辨率:CVPR2020论文解析
慢镜头变焦:视频超分辨率:CVPR2020论文解析 Zooming Slow-Mo: Fast and Accurate One-Stage Space-Time Video Super-Resol ...