Codeforces Solution | 707A: Brain's Photos

Codeforces | 31 May, 2021

Problem Description:


In this problem, a photo can be represented as a matrix sized \(n × m\), and each element of the matrix stores a symbol indicating corresponding pixel color. There are only 6 colors:


  • 'C' (cyan)
  • 'M' (magenta)
  • 'Y' (yellow)
  • 'W' (white)
  • 'G' (grey)
  • 'B' (black)


If there is any pixel of C, M, Y in the photo, then it is colored. Otherwise, it is black and white. We have to find out that the photo is black and white or colored.


Ideological Analysis:


Black and white photos contain only ‘B’, ‘W’ and ‘G’ pixels. We can check if any pixel is found ‘C’, ‘M’ or ‘Y’ then print "#Color" (without quotes). Otherwise, print "#Black&White" (without quotes).


Click here for Source Code.

Tanjina Rahman, 31 May, 2021


Share this article on →