HRBUST1200-装修
来源:互联网 发布:机器人的编程语言 编辑:程序博客网 时间:2024/05/05 01:16
装修Time Limit: 1000 MSMemory Limit: 65536 KTotal Submit: 707(385 users)Total Accepted: 435(356 users)Rating: Special Judge: NoDescriptionhero为了能顺利娶princess ,花了血本,买了个房子,现在决定装修。房子的长度为n米,宽度为3米,现在我们有2种地砖,规格分别是1米×1米,2米×2米,如果要为该教室铺设地砖,请问有几种铺设方式呢?Input输入数据首先包含一个正整数C,表示包含C组测试用例,然后是C行数据,每行包含一个正整数n(1<=n<=30),表示教室的长度。Output对于每组测试数据,请输出铺设地砖的方案数目,每个输出占一行。Sample Input2
2
3Sample Output3
5Author王勇
2
3Sample Output3
5Author王勇
解题思路:简单dp
#include <iostream>#include <cstdio>#include <string>#include <cstring>#include <algorithm>#include <cmath>#include <queue>#include <vector>#include <set>#include <stack>#include <map>#include <climits>using namespace std;#define LL long longconst int INF=0x3f3f3f3f;int n;LL a[40];void init(){ a[1]=1,a[2]=3; for(int i=3;i<=30;i++) a[i]=a[i-1]+2*a[i-2];}int main(){ init(); int t; scanf("%d",&t); while(t--) { scanf("%d",&n); printf("%lld\n",a[n]); } return 0;}
0 0
- HRBUST1200-装修
- HRBUST1200 装修
- 装修
- 装修
- 装修
- 装修
- 装修
- 、装修
- 装修
- 装修
- 装修
- 装修
- 装修
- 装修
- 装修,装修... ...
- 装修经历
- 装修游记
- 关于装修
- 66:Same Tree
- Python基础:Python数据类型详解之字典与字符串
- 墨妈的教学笔记之《数据压缩》之一—绪论(数据压缩的可行性及思路)
- StringBuffer和StringBuilder的区别
- 属性的设置与使用
- HRBUST1200-装修
- Flink-CEP之带版本的共享缓冲区
- python在vs2013下的编译
- github入门
- 开源项目使用问题集锦
- 调整multiselect宽度
- java中static方法的使用问题
- Pillow学习之Image
- 参加航天科工辅导营的感想