Fill the Grid with three colors A, B and C

Правка en1, от algorithms400, 2018-02-22 16:03:00

How to find the numbers of ways to fill a grid (3*n)array, with three colors A, B and C.

Under the following constraints:

1) All the n cells of the same row can't have the same color.

2) All the 3 cells of the same column can't have the same color.

Sample input : if n=2, then output or number of ways = 174.

Please explain the approach for this.

Теги 2d-dp, #algorithms, #combinatorics, #matrix

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский algorithms400 2018-02-22 16:03:00 411 Initial revision (published)