Tri Tiling[HDU1143]
Tri Tiling
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 1631 Accepted Submission(s): 928
Problem Description
In how many ways can you tile a 3xn rectangle with 2x1 dominoes? Here is a sample tiling of a 3x12 rectangle.
Input
Input consists of several test cases followed by a line containing -1. Each test case is a line containing an integer 0 ≤ n ≤ 30.
Output
For each test case, output one integer number giving the number of possible tilings.
Sample Input
2
8
12
-1
Sample Output
3
153
2131
Source
University of Waterloo Local Contest 2005.09.24
Recommend
Eddy
#include<stdio.h>
#include<string.h>
__int64 f[][];
int main()
{
memset(f,,sizeof(f));
f[][]=;
f[][]=;
f[][]=;
f[][]=;
f[][]=;
f[][]=;
f[][]=;
f[][]=;
int i;
for (i=;i<=;i++)
{
if (i>=) f[i][]=f[i-][]+f[i-][]+f[i-][];
f[i][]=f[i-][];
f[i][]=f[i-][];
f[i][]=f[i][]+f[i-][];
f[i][]=f[i-][];
f[i][]=f[i-][];
f[i][]=f[i][]+f[i-][];
}
int n;
while (scanf("%d",&n)!=EOF)
{
if (n==-) return ;
printf("%I64d\n",f[n][]);
}
return ;
}
Tri Tiling[HDU1143]的更多相关文章
- Tri Tiling(hdu1143)
Tri Tiling Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total ...
- POJ 2663 Tri Tiling
Tri Tiling Time Li ...
- uva 10918 - Tri Tiling(规律)
题目链接:uva 10918 - Tri Tiling 题目大意:给出n,计算用1*2的瓷砖有多少种方法铺满3*n的地方. 解题思路:和uva 10359 - Tiling有点相似,不过难度会比较大, ...
- POJ 2663 Tri Tiling 矩阵快速幂 难度:3
Tri Tiling Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7841 Accepted: 4113 Descri ...
- HDU 1143 Tri Tiling
链接:http://acm.hdu.edu.cn/showproblem.php? pid=1143 Tri Tiling Time Limit: 2000/1000 MS (Java/Others) ...
- HDU 1143 Tri Tiling (递推)
Tri Tiling Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total ...
- I - Tri Tiling
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status #in ...
- POJ 2663 Tri Tiling 【状压DP】
Description In how many ways can you tile a 3xn rectangle with 2x1 dominoes? Here is a sample tilin ...
- HDU 1143 Tri Tiling 递归问题
将一个3*n的矩形用1*2的矩形填充,n为奇数时一定不能被填满,n*3%2==1 接下来处理这个问题我们要从简单的情况开始考虑,所谓递归就是要能将问题的规模不断减小,通过小问题的解决最后将复杂问题解决 ...
随机推荐
- [Effective JavaScript 笔记]第40条:避免继承标准类
ECMAScript标准库里配备了许多重要的类,如Array,function,以及Date等.扩展这些类生成子类可以方便完成很多工作,但它们的定义具有很多特殊的行为,所以很难写出行为正确的类. Ar ...
- easyui 删除行bug
easyui删除行,出现了bug.(经常使用这个框架的人几乎都会遇到) 我也非常纳闷,今天特地试了很久. 最后发现,如果是自己datagrid('getRows') 然后迭代出来,最后算出行号,可以成 ...
- Linux中启动和停止jar包的运行
脚本一: startTest.sh内容如下: #!/bin/sh java -jar Test.jar & #注意:必须有&让其后台执行,否则没有pid生成 echo $! ...
- 在Windows Server 2012 中安装 .NET 3.5 Framework
问题 如今,仍然有许多程序和应用需要依靠.NET 3.5 framework 来运行.在Windows Server 2012中,微软提供了.NET 3.5 和.NET 4.5的安装选项以为你的应用程 ...
- Ubuntu上安装gtk2.0不能安装的问题,“下列的软件包有不能满足的依赖关系”
zez@localhoss:~$ sudo apt-get install libgtk2.0-dev正在读取软件包列表... 完成正在分析软件包的依赖关系树 正在读取状态信息... 完成 ...
- 【leetcode】Implement strStr()
Implement strStr() Implement strStr(). Returns the index of the first occurrence of needle in haysta ...
- linux shell脚本守护进程监控svn服务
最近搭建的svn服务不知道什么原因服务总是被关闭(如果你不知道怎么搭建svn可以参考linux下搭建svn版本控制软件),因此用shell脚本实现一个守护进程.用于监控svn服务是否启动,如果服务不在 ...
- 转centos65安装简测mysql cluster 7.3.7
MySQLCluster是sharednothing分布式架构,ndb存储引擎把数据放置于内存中.可以做到无单点故障.由运行于不同服务器上的的多种进程构成,组件包括SQL节点,NDBD数据节点,管理程 ...
- ubuntu 下wireshark 软件安装与使用
在ubuntu下,使用wireshark也是很有必要的.虽然可以使用tcpdump等工具. ubuntu:11.10 1. sudo apt-get install wireshark ...
- 归并排序(merge sort)
M erge sort is based on the divide-and-conquer paradigm. Its worst-case running time has a lower ord ...