Job four recursive solver

Source: Internet
Author: User

Record a bit.

1 /*2 2015.6 HT3 ACM work_44 5 */6#include <iostream>7#include <algorithm>8 using namespacestd;9 Ten /* One Super Staircase A a total of a staircase of M-class, just start at the first level, each time can only step up one or two levels - How many ways do you have to walk on the first grade m?  - input Each line contains an integer M (1<=m<=40), which represents the series of stairs the  - directly construct a Fibonacci sequence within 40, f1=1,f2=1 - */ - //int sum, M, a[41]; + //void f () - //{ + //a[1] = 1; A //a[2] = 1; at //for (int i = 3; I <=; i++) - //A[i] = a[i-1] + a[i-2]; - //} - // - //int main () - //{ in //int n; - //f (); to //cin >> N; + //While (n--) - //    { the //cin >> m; * //cout << a[m] << Endl; $ //    }Panax Notoginseng //return 0; - //} the  +  A  the /* + not Easy series of (3)--lele RPG puzzles - a row of n squares with red (red), Pink (Pink), Green (green) three-color-coated each lattice $ each color, requires that any adjacent squares can not be the same color, and the end of the two blocks are also different colors. All the requirements of the coating method $ (0<n<=50) -  - 1. The front n-1 to fill the color, there is f (n-1) case, at this time the first n-1 with the color must be different, so nth only one choice the 2. N-2 to the front of the box, there is an F (n-2) case, the n-1 space color is the same as the first color, the last nth squares can fill two colors, so it is 2*f (n-2) - launches F (n) =f (n-1) +2 (n-2) n>=4Wuyi */ the //int main () - //{ Wu //int i; - //    //int will overflow About //__int64 d[51] = {0, 3, 6, 6}; $ //For (i = 4; i < Wuyi; i++) - //D[i] = d[i-1] + 2 * d[i-2]; - //While (CIN >> i) - //cout << d[i] << Endl; A // + //return 0; the //} -  $  the  the /* the polyline split plane the f (n) = 2n^2-n+1 -  in closed curve split plane the f (n) = n^2-n+2 the  About Planar split Space the f (n) = (n^3+5n)/6+1 the */ the  +  -  the /*Bayi Mourning for 512 Wenchuan earthquake--rebuilding Hope Primary School the the length of the school classroom is n meters, the width is 3 meters, now we have 2 kinds of tiles, the specifications are 1 meters x1 meters, 2 meters x2 meters, the if you want to lay a floor tile for the classroom, how many kinds of paving?  -  - S[n]=s[n-1]+2*s[n-2] the */ the intMain () the { the     intn[ to], I, M, T; -n[1] =1; then[2] =3; the      for(i =3; I <= -; ++i) the     {94N[i] = n[i-1] + n[i-2] *2; the     } theCIN >>T; the      while(t--)98     { AboutCIN >>m; -cout << N[m] <<Endl;101     }102     return 0;103 }104  the 106 107 /*108 Statistical issues109 You can go left, you can go right, or you can go up. the through the lattice immediately collapse can no longer go the second time, beg to go n steps different program number111  the The number of steps to go up is a (n), and the number of steps left or right is B (n)113 f (N) =a (n) +b (n) the A (n) =a (n-1) +b (n-1), B (n) =2*a (n-1) +b (n-1) the Simplification f (n) = 2*f (n-1) + f (n-2) the */

Job four recursive solver

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.