# Some mathematical formulas

Source: Internet
Author: User

There are rows of n squares, with red, pink, green three-color coating each lattice, each lattice painted a color, the requirements of any adjacent squares can not be the same colour, and the first and the first two blocks also different colors. All the requirements of the coating method.

F (n) =f (n-1) +2*f (n-2);

The idea of wrong line:

When n numbered elements are placed in n numbered positions, the number of methods that do not correspond to the number of the element and the position number is expressed in M (n), then M (n-1) indicates that the n-1 number element is placed in the n-1 number position, the number of methods that do not correspond, and other analogies.

The first step, put the nth element in a position, such as position k, altogether there are n-1 methods;

The second step, put the element numbered K, there are two cases. 1, put it to position N, then, for the remaining n-2 elements, there is M (n-2) method, 2, do not put it to position N, at this time, for this n-1 element, there is M (n-1) method;

The Comprehensive

M (n) = (n-1) [M (n-2) +m (n-1)]

Specifically, M (1) =0,m (2) =1 Congruent Triangular Division number (HDU 1396)a[i] = a[i-1]+i* (i+1)/2;

Some mathematical formulas

Related Keywords:

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.