UVa 183

From Algorithmist
Jump to navigation Jump to search

Involves recursion and matrices. Follow this basic algorithm.

Use a string to keep track of 1's, 0's, and D's. If (all values in portion of matrix aren't 0 or 1){

   add 'D' to the String
   recurse with the following values:
      upper left portion of matrix 
      upper right portion of matrix
      lower left portion of matrix 
      lower right portion of matrix

}else if(all values are 0 or 1){

  Add '0' or '1' to the String

}