19.10 students stand in a row, and the teacher wants to give each student a hat. There are two colors of hats: red and white, and the number of hats of each color is more than 10. Requirement: In any number of consecutive adjacent students, the difference in the number of students wearing red hats and those wearing white hats should not exceed 2. How many ways can the teacher distribute the hats?
【Answer】94
Analysis: This problem is very difficult, mainly due to the statement "the difference in the number of students wearing red hats and white hats in any consecutive adjacent students is at most 2." The following are several attempts to solve it.
(Use √ to represent wearing a red hat, × to represent wearing a white hat)
Method One: Ordered Enumeration, combined with the graphical numbering method. Moving one grid to the right represents wearing a red hat, moving one grid up represents wearing a white hat, completing a total of 10 grids.
Note: (1) No more than two consecutive steps in the same direction; (2) The difference in the number of grids in the horizontal and vertical directions between any two points taken must be at most 2, such as points a and b cannot both exist at the same time. (Grids 1×4, 2×5, 3×6 are not allowed, which can easily lead to overcounting)
Counting this way, there are 47 types below.
This is for starting with √, a total of 47 types, and starting with × also has 47 types, totaling $47 \times 2=94$ types.
Method Two: Categorization and Enumeration
Based on "the difference in the number of students wearing red hats and white hats in any consecutive adjacent students is at most 2," the difference in the number of students wearing red hats and white hats among all students is also at most 2. Therefore, there are three cases: 6 red 4 white, 5 red 5 white, and 4 red 6 white. Among these, 6 red 4 white and 4 red 6 white are symmetrical, with the same number of types.
(1) 6 red 4 white
Divide the reds into three groups: red red, red red, red red
$4-2=2$, there must be two whites between red red and red red, 1 type:
Subtotal, 6 reds divided into three groups total 1 type:
(2) 6 reds divided into four groups: red red, red red, red, red
(1) red red, red red, red, red
There must be two whites between red red and red red, 1 type:
(2) red, red, red red, red red
Same as (1), by symmetry, 1 type
(3) red red, red, red red, red
There must be one white and one double white in the gaps, 2 types:
$\checkmark \checkmark, \times, \sqrt{ } \times \times, \checkmark \sqrt{ } \times \times, \sqrt{ }$
(4) red, red red, red, red red
Same as (3), 2 types
(5) red red, red, red, red red
$6-2=4$, it is impossible to place whites at both ends, 3 types:
$\checkmark \checkmark, \times \times, \checkmark, \times, \checkmark, \times, \checkmark \checkmark$ $\checkmark \checkmark, \times, \checkmark, \times \times$,
(6) red, $\times, \vee, \times, \vee, \times \times, \vee \vee$;
There must be two whites between red red and red red, 1 type:
Subtotal, 6 reds divided into four groups total $1+1+2+2+3+1=10$ types;
(3) 6 reds divided into five groups: red red, red, red, red, red
(1) red red in the first or fifth position, four gaps each insert 1 white, total 2 types;
(2) red red in the second, third, or fourth position, four gaps each insert 1 white, total 3 types
Subtotal, 6 reds divided into five groups total $2+3=5$ types;

Therefore, 6 reds 4 whites total $1+10+5=16$ types;
(2) 4 reds 6 whites
Same as 6 reds 4 whites, total 16 types;
(3) 5 reds 5 whites
(1) 5 reds divided into three groups: red red, red red, red
(1) red red, red red, red
There must be two whites between the first gap of red red and red red, the second gap can be 1 white or 2 whites, 5 types:
$\qquad$
(2) red, red red, red red

Same as (1), by symmetry, 5 types;
(3) red red, red, red red
$5-2=3,1+2=3$, the two gaps must be one 1 white and one 2 whites, 6 types
$\times, \vee \checkmark, \times \times, \vee, \times, \sqrt{ } \times$;

Subtotal, 5 reds divided into three groups total $5+5+6=16$ types;
(2) 5 reds divided into four groups: red red, red, red, red
(1) red red, red, red, red
$1+2=3,2+2=4$, the three gaps are 3 to 4 whites, 9 types:
$\qquad$
$\qquad$
$\qquad$
$\qquad$ (2) red, red, red, red red

Same as (1), by symmetry, 9 types:
(3) red, red red, red, red
$1+2=3$, the gaps on both sides of red can have at most one 2 whites, based on the number of 2 whites in three gaps, it can be $2,1,0$, 11 types: $\qquad$
$\qquad$
$\qquad$
$\qquad$
$\qquad$
(4) red, red, red red, red

Same as (3), 11 types;
Subtotal, 5 reds divided into four groups total $9+9+11+11=40$ types
(3) 5 reds divided into five groups: red, red, red, red, red, four gaps each use 1 white, the remaining 1 white can be placed in 6 positions, 6 types:
$\qquad$
$\qquad$
$\qquad$
$\qquad$
Subtotal, 5 reds divided into five groups total 6 types
Therefore, 5 reds 5 whites total $16+40+6=62$ types;
$\qquad$