Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u

Submit Status

 #include<cstdio>
using namespace std;
int f(int n)
{
if(n==)
return ;
if(n==)
return ;
else
return *f(n-)-f(n-);
}
int main()
{
int n;
while(scanf("%d",&n)==&&n!=-)
if(n%==)
printf("%d\n",f(n));
else
printf("%d\n",);
return ;
}

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 DP!

I - Tri Tiling的更多相关文章

  1. Tri Tiling[HDU1143]

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

  2. Tri Tiling(hdu1143)

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

  3. POJ 2663 Tri Tiling

                                                                                    Tri Tiling   Time Li ...

  4. uva 10918 - Tri Tiling(规律)

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

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

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

  6. HDU 1143 Tri Tiling

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

  7. HDU 1143 Tri Tiling (递推)

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

  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. DIV使用tabindex获得事件详解 移动div

    添加 tabindex='-1' 属性: 默认:获取不到焦点事件(blur) 1 <div class="wl-product" id="wl-product&qu ...

  2. mvc学习记录

    1.关于mvc中的session在controller中传递 在用mvc开发新项目的时候,不久就遇到一个头大的问题,session在controller中传递居然出现空值,但明明一开始就赋值了,通过度 ...

  3. ios基础篇(一)——UIView控件基本属性与常见用法

    1.frame 控件的位置和尺寸(以父控件的左上角为坐标原点(0,0)) 2.center 控件的中点(以父控件的左上角为坐标原点) 3.bounds 控件的位置和尺寸(以自己的左上角为坐标原点(0, ...

  4. 230. Kth Smallest Element in a BST ——迭代本质:a=xx1 while some_condition: a=xx2

    Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Not ...

  5. JDE报表开发笔记(R5537011 收货校验统计表)

    业务场景:根据批次收货,收货后对该批次产品进行检验,记录检验结果生成统计表. 涉及表:主表F37011,业务从表F43121/F4101/F4108 ------------------------- ...

  6. placeholder修改颜色

    :-moz-placeholder { /* Mozilla Firefox 4 to 18 */ color: #f00; } ::-moz-placeholder { /* Mozilla Fir ...

  7. POJ 3206 最小生成树

    DESCRIPTION:T_T 在下是读不懂题意的.但是捏.现在知道是求把所有的点(是字母的点)连起来的最小的权值.即最小生成树.因为求最小生成树是不计较源点是哪个的.所以可以把A和S看成一样的.首先 ...

  8. 【bzoj2281】[Sdoi2011]黑白棋

    博弈论---Nimk问题. dp再搞搞. 很容易看出,该游戏的终态是每两个棋子都紧靠着.当一颗棋子移动,另一方与该棋子对应的那一刻可以立即追上,使得仍旧紧靠,最终棋子动弹不得,游戏结束. 还能看出,对 ...

  9. pthreads 0.1.0 测试报告

    1 可以说已经稳定了 2 发现一个算是技巧的东西吧:在线程之间传递的类的实例,要保证能正常工作,需要类本身extends Stackable,所有方法都弄成public--我原来了写了一个数据库操作类 ...

  10. C语言中 scanf 和 printf 的小要点

    1 scanf_s需指定%c 个数 h short l long关键字 * 不赋给任何值 W 指定读入宽度 转换字符 a 读浮点值(c99) A 读浮点值(c99) c 读单字符 d 读十进制数 i ...