Dominoes Shop SquaresTime
limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 30790 Accepted Submission (s): 14905
problem DescriptionIn a rectangular square of 2xn, fill the squares with a 1x2 domino, enter N, and output the total number of paving schemes.
For example, when n=3, for 2x3 squares, the Domino placement scheme has three kinds, such as:
InputThe input data consists of multiple lines, each containing an integer n, indicating that the size of the rectangular square of the test instance is 2xn (0<n<=50).
OutputFor each test instance, output the total number of placement scenarios, one row for each instance output.
Sample Input
132
Sample Output
The idea of solving the problem: The application of Fibonacci sequence source code:#include <stdio.h> #include <stdlib.h>int Main () {int i,n; Long Long a[51]={0,1,2}; for (i=3;i<51;i++) a[i]=a[i-1]+a[i-2]; while (scanf ("%d", &n)!=eof) {printf ("%i64d\n", A[n]); } system ("Pause"); return 0; }
Dominoes Shop Squares