The Mook Jongaccepts:506submissions:1281Time limit:2000/1000 MS (java/others)Memory limit:65536/65536 K (java/others)Problem Description
Zjiaq want to become a strong mans, so he decided to play the Mook Jong. Zjiaq want to put some Mook jongs in his backyard. His backyard consist of n bricks which 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 both Mook jongs should be equal or more than 2 bricks. Now Zjiaq want to know what many ways can Zjiaq put Mook jongs legally (at least one Mook Jong).
Input
There ar multiply cases. For each case, there was a single integer n (1 < = n < = 60)
Output
Print the ways.
Sample Input
123456
Sample Output
1235812
1#include <stdio.h>2#include <string.h>3 intMain ()4 {5 Long LongN;6 Long Longdp1[ the],dp2[ the];7 inti,j,k;8 while(SCANF ("%i64d", &n)! =EOF)9 {Tenmemset (DP1,0,sizeof(DP1)); Onememset (DP2,0,sizeof(DP2)); Adp1[1]=1, dp2[1]=1; -dp1[2]=2, dp2[2]=1; -dp1[3]=3, dp2[3]=1; the for(i=4; i<=n;i++) - { -dp1[i]=dp1[i-1]+dp2[i-1]; -dp2[i]=dp1[i-3]+dp2[i-3]; + } -printf"%i64d\n", dp1[n]+dp2[n]-1); + } A return 0; at}
View Code
Bc#50 1003 The Mook Jong