UVa 900 - Brick Wall Patterns
题目大意:用1*2的砖头建n*2的墙,问有多少种不同的砖头排列方式?与斐波那契序列相似。
#include <cstdio>
#define MAXN 60
#define N 50 unsigned int F[MAXN]; int main()
{
#ifdef LOCAL
freopen("in", "r", stdin);
#endif
F[] = ;
F[] = ;
for (int i = ; i <= N; i++)
F[i] = F[i-] + F[i-];
int n;
while (scanf("%d", &n) && n)
printf("%u\n", F[n]);
return ;
}
UVa 900 - Brick Wall Patterns的更多相关文章
- [LeetCode] Brick Wall 砖头墙壁
There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. The b ...
- [Swift]LeetCode554. 砖墙 | Brick Wall
There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. The b ...
- 554. Brick Wall最少的穿墙个数
[抄题]: There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. ...
- [LeetCode] 554. Brick Wall 砖头墙壁
There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. The b ...
- 【LeetCode】554. Brick Wall 解题报告(Python)
[LeetCode]554. Brick Wall 解题报告(Python) 标签(空格分隔): LeetCode 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fux ...
- UVa 10384 - The Wall Pushers
链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- UVa 11587 - Brick Game
称号:背景:brick game有N块,给你一个整数的定数S,两个人轮流木: 的木块数是集合S中存在的随意数字.取走最后木块的人获胜.无法取则对方获胜. 题干:如今让你先取,给你一个你的结果序列串T, ...
- UVa Live 4670 Dominating Patterns - Aho-Corasick自动机
题目传送门 快速的通道I 快速的通道II 题目大意 给定一堆短串,和一个文本串,问哪些短串在文本串中出现的次数最多. 我觉得刘汝佳的做法,时间复杂度有问题.只是似乎这道题短串串长太短不好卡.比如给出的 ...
- 554. Brick Wall
class Solution { public: int leastBricks(vector<vector<int>>& wall) { unordered_map& ...
随机推荐
- HDU 3038 How Many Answers Are Wrong (并查集)---并查集看不出来系列-1
Problem Description TT and FF are ... friends. Uh... very very good friends -________-bFF is a bad b ...
- java面向对象_接口
java接口 interface,是一个抽象类型,是抽象方法的集合,接口通常以interface来声明.一个类通过继承接口的方式,从而来继承接口的抽象方法. 接口并不是类,编写接口的方式和类很相似,但 ...
- 微软企业库3.1DIY编译使用(数据库连接符写在企业库DLL里)
1.在winform项目app.config文件中去掉"PublicKeyToken=b03f5f7f11d50a3a"(不然无法加载使用新编译的企业库DLL文件) 2.在企业库所 ...
- 优化viewHolder
- RedHat Enterprise Linux AS4&5 安装gcc过程
三.Gcc安装方法(redhat 4): 一.安装步骤 1.使用which gcc命令查看gcc是否安装安装 2.如若没有安装则下载如下安装包,所需安装包如下 一共需要拷贝以下五个安装包: binut ...
- 第13章 Swing程序设计----常用事件监听器
组件本身并不带有任何功能.这时需要为这些组件添加特定事件监听器. Swing中常用的两个事件监听器,即动作事件监听器和焦点事件监听器.
- css position relative obsolution
层级关系为:<div ——————————— position:relative; 不是最近的祖先定位元素,不是参照物<div—————————-没有设置为定位元素,不是参照物<di ...
- I2C死锁原因及解决方法(转)
源:http://blog.csdn.net/zyboy2000/article/details/5603091 死锁总线表现为:SCL为高,SDA一直为低 现象:单片机采用硬件i2c读取E2PROM ...
- strut1.X和spring整合的二种方法
第一种集成方法 原理:在Action中取得BeanFactory对象,然后通过BeanFactory获取业务逻辑对象 缺点:产生了依赖,spring的类在action中产生了依赖查找.(注意和依赖注入 ...
- 2016沈阳网络赛 QSC and Master
QSC and Master Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) ...