码迷,mamicode.com
首页 > 其他好文 > 详细

骨牌铺方格(杭电2046)

时间:2014-12-03 01:48:28      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   io   ar   color   os   sp   

骨牌铺方格

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 30887    Accepted Submission(s): 14949


Problem Description
在2×n的一个长方形方格中,用一个1× 2的骨牌铺满方格,输入n ,输出铺放方案的总数.
例如n=3时,为2× 3方格,骨牌的铺放方案有三种,如下图:
bubuko.com,布布扣
 

Input
输入数据由多行组成,每行包含一个整数n,表示该测试实例的长方形方格的规格是2×n (0<n<=50)。
 

Output
对于每个测试实例,请输出铺放方案的总数,每个实例的输出占一行。
 

Sample Input
1 3 2
 

Sample Output
1 3 2
 

Author
lcy
 

Source
#include<stdio.h>
__int64 a[55];
int main()
{
	int i,j,n;
	a[1]=1,a[2]=2;
	for(i=3;i<=50;i++)
	{
		a[i]=a[i-1]+a[i-2];
	}
	while(scanf("%d",&n)!=EOF)
	{
		printf("%I64d\n",a[n]);
	}
	return 0;
}

骨牌铺方格(杭电2046)

标签:des   style   blog   http   io   ar   color   os   sp   

原文地址:http://blog.csdn.net/hdd871532887/article/details/41688827

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!