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. 四则运算(Android版)

    MainActivity: package com.example.demon; import android.os.Bundle; import android.app.Activity; impo ...

  2. PHP 单引号和双引号的区别

    $a = 'jfdjaff';$b = '234125';$c = '"jj $a $b"'.PHP_EOL;echo $c;$c = 'jj $a $b'.PHP_EOL;ech ...

  3. 推荐10款非常优秀的 HTML5 开发工具

      HTML5 发展如火如荼,随着各大浏览器对 HTML5 技术支持的不断完善以及 HTML5 技术的不断成熟,未来 HTML5 必将改变我们创建 Web 应用程序的方式.今天这篇文章向大家推荐10款 ...

  4. / etc / init.d / iptables: line 268: restorecon: command not found

    When I tried to restart iptables from vps , I got the following error. Iptables encountered such a p ...

  5. ASP.NET MVC统一异常处理

    前言: 今早看了篇文章:求知成瘾,却无作品 的思考:很有感触,发现原来自己也是这样,对每样东西都抱有很大的兴趣或者希望自己去学,一年后发现原来自己什么都是皮毛什么都不精!最终发现真正的大牛都是在某一个 ...

  6. visual studio 2013连接Oracle 11g并获取数据:(二:实现)

    1.VS中新建一个winform窗体 (1)一个按钮 (2)一个数据表格视图(在里面显示得到的数据表) 2.双击按钮进入代码 (1)添加 using System.Data.OracleClient; ...

  7. 使用ROS节点(五)

    先启动roscore roscore 为了获取节点信息,可以使用rosnode命令 $ rosnode 获取得一个可接受参数清单

  8. Android 之 JSON操作

    Android默认已经集成了操作JSON相关的API,如下所示: 也可以不使用JSON工具类,直接使用字符串拼接. 注意:可以使用字符串来构造JSONArray和JSONObject,这就是JSON解 ...

  9. android 定时器的使用

    1.android中通常是使用AlarmManager来定时启动一个单次或重复多次操作的.具体的说就是我们通过AlarmManager设定一个时间和注册一个intent到系统中,然后在该时间到来时,系 ...

  10. for循环和while循环的区别

    public class Xunhuanqubie { public static void main(String[] args){ int i = 0; while(i<8){ System ...