博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
BC#50 1003 The mook jong
阅读量:6864 次
发布时间:2019-06-26

本文共 1398 字,大约阅读时间需要 4 分钟。

The mook jong

 
 Accepts: 506
 
 Submissions: 1281
 Time Limit: 2000/1000 MS (Java/Others)
 
 Memory Limit: 65536/65536 K (Java/Others)
Problem Description

ZJiaQ want to become a strong man, so he decided to play the mook jong。ZJiaQ want to put some mook jongs in his backyard. His backyard consist of n bricks that is 1*1,so it is 1*n。ZJiaQ want to put a mook jong in a brick. because of the hands of the mook jong, the distance of two mook jongs should be equal or more than 2 bricks. Now ZJiaQ want to know how many ways can ZJiaQ put mook jongs legally(at least one mook jong).

Input

There ar multiply cases. For each case, there is a single integer n( 1 < = n < = 60)

Output

Print the ways in a single line for each case.

Sample Input
1	23456
Sample Output
1235812
1 #include 
2 #include
3 int main() 4 { 5 long long n; 6 long long dp1[66],dp2[67]; 7 int i,j,k; 8 while(scanf("%I64d",&n)!=EOF) 9 {10 memset(dp1,0,sizeof(dp1));11 memset(dp2,0,sizeof(dp2));12 dp1[1]=1,dp2[1]=1;13 dp1[2]=2,dp2[2]=1;14 dp1[3]=3,dp2[3]=1;15 for(i=4;i<=n;i++)16 {17 dp1[i]=dp1[i-1]+dp2[i-1];18 dp2[i]=dp1[i-3]+dp2[i-3];19 }20 printf("%I64d\n",dp1[n]+dp2[n]-1);21 }22 return 0;23 }
View Code

 

转载于:https://www.cnblogs.com/cyd308/p/4771336.html

你可能感兴趣的文章