Number of ways to color boundary of each block of M * N table | C ++ program to count the number of ways to color boundary of each block of M * N table . ; Function to compute all way to fill the boundary of all sides of the unit square ; Count possible ways to fill all upper and left side of the rectangle M * N ; Count possible ways to fill all side of the all squares unit size ; Driver code ; Number of rows ; Number of columns
#include <bits/stdc++.h> NEW_LINE using namespace std ; int CountWays ( int N , int M ) { int count = 1 ; count = pow ( 3 , M + N ) ; count *= pow ( 2 , M * N ) ; return count ; } int main ( ) { int N = 3 ; int M = 2 ; cout << CountWays ( N , M ) ; return 0 ; }