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]的更多相关文章

  1. Tri Tiling(hdu1143)

    Tri Tiling Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

  2. POJ 2663 Tri Tiling

                                                                                    Tri Tiling   Time Li ...

  3. uva 10918 - Tri Tiling(规律)

    题目链接:uva 10918 - Tri Tiling 题目大意:给出n,计算用1*2的瓷砖有多少种方法铺满3*n的地方. 解题思路:和uva 10359 - Tiling有点相似,不过难度会比较大, ...

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

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

  5. HDU 1143 Tri Tiling

    链接:http://acm.hdu.edu.cn/showproblem.php? pid=1143 Tri Tiling Time Limit: 2000/1000 MS (Java/Others) ...

  6. HDU 1143 Tri Tiling (递推)

    Tri Tiling Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total ...

  7. I - Tri Tiling

      Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status #in ...

  8. POJ 2663 Tri Tiling 【状压DP】

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

  9. HDU 1143 Tri Tiling 递归问题

    将一个3*n的矩形用1*2的矩形填充,n为奇数时一定不能被填满,n*3%2==1 接下来处理这个问题我们要从简单的情况开始考虑,所谓递归就是要能将问题的规模不断减小,通过小问题的解决最后将复杂问题解决 ...

随机推荐

  1. [Effective JavaScript 笔记]第27条:使用闭包而不是字符串来封装代码

    函数是一种将代码作为数据结构存储的便利方式,代码之后可以被执行.这使得富有表现力的高阶函数抽象如map和forEach成为可能.它也是js异步I/O方法的核心.与此同时,也可以将代码表示为字符串的形式 ...

  2. [BZOJ3671][UOJ#6][NOI2014]随机数生成器

    [BZOJ3671][UOJ#6][NOI2014]随机数生成器 试题描述 小H最近在研究随机算法.随机算法往往需要通过调用随机数生成函数(例如Pascal中的random和C/C++中的rand)来 ...

  3. HDU 2897

    Problem Description 当日遇到月,于是有了明.当我遇到了你,便成了侣. 那天,日月相会,我见到了你.而且,大地失去了光辉,你我是否成侣?这注定是个凄美的故事.(以上是废话) 小t和所 ...

  4. 坚持不懈之linux haproxy的配置文件关键字查询手册

    1.关键词balance balance用于定义负载均衡的算法,可用于defaults.listen和backend中. balance使用方法如下: balance <algorithm> ...

  5. php页面打开响应时间

    $start_time = array_sum(explode(' ',microtime())); //your code here   $end_time = array_sum(explode( ...

  6. shell脚本调试之工具——bashdb

    bash是Unix/Linux操作系统最常用的shell之一,它非常灵活,和awk.c++配合起来异常强大 以下使用一个测试脚本来说明使用bash调试的方法 test.sh #!/bin/bash e ...

  7. raw格式镜像文件压缩并转换为qcow2格式

    raw格式文件,这个比较占用空间,你可以用以下命令将其压缩并转换成qcow2格式. # virt-sparsify --compress --convert qcow2 ubuntu.img ubun ...

  8. ubuntu14.04 中国源

    deb http://cn.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiversedeb http://cn.arc ...

  9. 【Django】Django 如何使用 Django设置的日志?

    代码: from django.core.management.base import BaseCommand, CommandError from django.db import models # ...

  10. [SVN(ubuntu)] ubuntu使用svn

    转载自:http://lee2013.iteye.com/blog/1058047 SVN作为日常开发中不可缺少的工具,Ubuntu下的SVN安装十分简单,sudo apt-get install s ...