Timus Online Judge:1225. Flags
来源:互联网 发布:linux ntp服务器搭建 编辑:程序博客网 时间:2024/06/01 10:47
1225. Flags
Time limit: 1.0 second
Memory limit: 64 MB
Memory limit: 64 MB
On the Day of the Flag of Russia a shop-owner decided to decorate the show-window of his shop with textile stripes of white, blue and red colors. He wants to satisfy the following conditions:
- Stripes of the same color cannot be placed next to each other.
- A blue stripe must always be placed between a white and a red or between a red and a white one.
Determine the number of the ways to fulfill his wish.
Example. For N = 3 result is following:
Input
N, the number of the stripes, 1 ≤ N ≤ 45.
Output
M, the number of the ways to decorate the shop-window.
Sample
3
4
Problem Source: 2002-2003 ACM Central Region of Russia Quarterfinal Programming Contest, Rybinsk, October 2002
Tags: dynamic programming
)又是一道Difficulty:44的水题,方法是使用DP,类似于斐波那契数列。
我一开始是使用迭代的方法,但是居然超时了。
然后,我直接赋值到数组里,然后,直接输出:
0 0
- Timus Online Judge:1225. Flags
- Timus Online Judge 哥德巴赫猜想
- Timus Online Judge 1033 Labyrinth
- Timus Online Judge:1119. Metro
- 1350. Canteen Timus Online Judge
- Timus 1225. Flags dp
- Timus 1225. Flags
- Timus Online Judge 1658 Sum of Digits
- Timus Online Judge 1982 Electrification Plan
- Timus Online Judge 1742 Team building
- Timus Online Judge 2045 Richness of words
- Timus Online Judge 1651 Shortest Subchain
- Timus Online Judge 1045 Funny Game
- Timus Online Judge 1966 Cycling Roads
- Timus Online Judge:1040. Airline Company
- Timus Online Judge:1820. Ural Steaks
- Timus Online Judge:1100. Final Standings
- 【Timus Online Judge 1132】 Square Root
- Jvm内存分配
- Android 仿IOS解锁锁屏文字抖动效果
- 动态绑定网卡后重启虚机网卡配置丢失问题
- Hibernate深入理解----01基础知识介绍及安装相关插件
- 2.1 ArrayAdapter的使用
- Timus Online Judge:1225. Flags
- Log打印--菜鸟初体验
- 使用Scrapy框架编写爬虫
- 排序算法之——基数排序(Java实现)
- 回调函数与钩子。
- Intellij Idea 快速开发
- C++ 对二维数组的遍历
- java中三种常见内存溢出错误的处理方法
- **Ubuntu14.04+CPU+Python+Opencv配置Fast RCNN**