Bc#50 1003 The Mook Jong

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.