Nyoj-bone plate shop Square

Source: Internet
Author: User
Bone Shop square time limit: 1000 MS | memory limit: 65535 kb difficulty: 2
Description
In a rectangle box of 2 × N, fill the square with a 1 × 2 bone card, input N, and output the total number of layout schemes.
For example, if n = 3, it is a 2 × 3 square. There are three methods for laying the bone card, for example:
Input
The input data is composed of multiple rows. Each row contains an integer N, indicating that the rectangular square of the test instance is 2 x n (0 <n <= 50 ).

Output
For each test instance, output the total number of placement schemes, and each instance outputs one row.

Sample Input
126
Sample output
1213
Source

HDU


Code:

#include<stdio.h>int main(){int i;long long f[51];f[1]=1;f[2]=2;f[3]=3;for(i=4;i<51;++i)f[i]=f[i-1]+f[i-2];int n;while(~scanf("%d",&n)){printf("%lld\n",f[n]);}return 0;}

Nyoj-bone plate shop Square

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.