Problem
Description
在2×n的一个长方形方格中,用一个1× 2的骨牌铺满方格,输入n
,输出铺放方案的总数.

例如n=3时,为2× 3方格,骨牌的铺放方案有三种,如下图:

L" title="Problem L">
Input
输入数据由多行组成,每行包含一个整数n,表示该测试实例的长方形方格的规格是2×n (0
Output
对于每个测试实例,请输出铺放方案的总数,每个实例的输出占一行。
Sample Input
1
3
2
Sample Output
1
3
2
题意:都是汉语就不用过解释了;
解题思路:刚开始的时候心思这题怎么用动态规划啊。。。。。。刚画了5个就找到规律了,斐波那契数列嘛;
感悟:英语选修课撸代码真是爽啊!
代码:
#include

#include

#define maxn 55

using namespace std;

long long ans[maxn],n;

void solve()

{

   
ans[1]=1;

   
ans[2]=2;

    for(int
i=3;i<=50;i++)

       
ans[i]=ans[i-1]+ans[i-2];

}

int main()

{

   
//freopen("in.txt","r",stdin);

   
solve();

   
while(~scanf("%lld",&n))

       
printf("%lld\n",ans[n]);

    return
0;

}


Problem L的更多相关文章

  1. The Ninth Hunan Collegiate Programming Contest (2013) Problem L

    Problem L Last Blood In many programming contests, special prizes are given to teams who solved a pa ...

  2. Gym 102056L - Eventual … Journey - [分类讨论][The 2018 ICPC Asia-East Continent Final Problem L]

    题目链接:https://codeforces.com/gym/102056/problem/L LCR is really an incredible being. Thinking so, sit ...

  3. 2013-2014 ACM-ICPC, NEERC, Southern Subregional Contest Problem L. Stock Trading Robot 水题

    Problem L. Stock Trading Robot 题目连接: http://www.codeforces.com/gym/100253 Description CyberTrader is ...

  4. XVII Open Cup named after E.V. Pankratiev Stage 14, Grand Prix of Tatarstan, Sunday, April 2, 2017 Problem L. Canonical duel

    题目:Problem L. Canonical duelInput file: standard inputOutput file: standard outputTime limit: 2 seco ...

  5. 2018 Multi-University Training Contest 4 Problem L. Graph Theory Homework 【YY】

    传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6343 Problem L. Graph Theory Homework Time Limit: 2000 ...

  6. HDU 6343.Problem L. Graph Theory Homework-数学 (2018 Multi-University Training Contest 4 1012)

    6343.Problem L. Graph Theory Homework 官方题解: 一篇写的很好的博客: HDU 6343 - Problem L. Graph Theory Homework - ...

  7. HDU 6330.Problem L. Visual Cube-模拟到上天-输出立方体 (2018 Multi-University Training Contest 3 1012)

    6330.Problem L. Visual Cube 这个题就是输出立方体.当时写完怎么都不过,后来输出b<c的情况,发现这里写挫了,判断失误.加了点东西就过了,mdzz... 代码: //1 ...

  8. 华农oj Problem L: CreatorX背英语【STL】

    Problem L: CreatorX背英语 Time Limit: 1 Sec Memory Limit: 64 MB Submit: 53 Solved: 36 [Submit][Status][ ...

  9. Problem L: 搜索基础之马走日

    Problem L: 搜索基础之马走日 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 134  Solved: 91[Submit][Status][W ...

随机推荐

  1. Android性能优化xml之<include>、<merge>、<ViewStub>标签的使用

    一.使用<include>标签对"重复代码"进行复用 <include>标签是我们进行Android开发中经常用到的标签,比如多个界面都同样用到了一个左侧筛 ...

  2. JAVA设计模式总结之23种设计模式

    上一篇总结了设计模式的六大原则<JAVA设计模式总结之六大设计原则>,这一篇,正式进入到介绍23种设计模式的归纳总结. 一.什么是设计模式                         ...

  3. Knapsack I 竟然是贪心,证明啊。。。。

    Knapsack I Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) SubmitSt ...

  4. @htmlhepler dropdownlistfor 报错

    说系统的字段不匹配. 是因为ViewData,没有赋值.

  5. 关于AVALON总线动态地址对齐

    在NIOS的使用中,我们往往要用到自定义外设,然后通过AVALON交换架构和NIOSII进行通信. AVALON总线,其实是一种交换架构的协议,在自定义外设挂在AVALON总线上时,一定要注意地址对齐 ...

  6. 使用Grub Rescue 修复MBR

    ubuntu 14.04 (本机) 1.使用以下命令查看分区: grub rescure> ls            (hd0,msdos7),(hd0,msdos8),(hd0,msdos9 ...

  7. c#(asp.net) 多线程示例,用于同时处理多个任务

    using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...

  8. C#用SerialPort实现串口通讯

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  9. http服务详解(1)——一次完整的http服务请求处理过程

    前言:要熟练掌握一个服务,首先需要非常了解这个服务的工作过程,这篇就详细解释了http服务的请求处理过程. 一次完整的http请求处理过程 (1)流程图 (2)过程详解 0.DNS域名解析:递归查询. ...

  10. 测试String.Format中的Format参数

    DateTime datetime = DateTime.Now; Console.WriteLine(String.Format("{0:d}", datetime)); // ...