Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //707A : BRAIN'S PHOTOS
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.InputStreamReader;
- import java.io.OutputStream;
- import java.io.PrintWriter;
- import java.util.StringTokenizer;
- //Your code goes here
- public class Main {
- static class ProblemSolver{
- public void solveTheProblem(InputReader in,PrintWriter out){
- /*
- * This is a very simple adhoc question
- * involving only character matching
- */
- //User inputs and other variables
- int row=in.nextInt();
- int col=in.nextInt();
- int total=row*col;
- String[] pixels=new String[total];
- boolean color=false;
- for(int i=0;i<total;++i)pixels[i]=in.next();
- //Evaluation of expression
- for(int i=0;i<total;++i){
- if(pixels[i].equals("C") || pixels[i].equals("M") || pixels[i].equals("Y")){
- color=true;
- break;
- }
- }
- //Displaying the result
- if(color)System.out.println("#Color");
- else System.out.println("#Black&White");
- }
- }
- //Default template for all the codes
- static class InputReader {
- public BufferedReader reader;
- public StringTokenizer tokenizer;
- public InputReader(InputStream stream) {
- reader = new BufferedReader(new InputStreamReader(stream),32768);
- tokenizer = null;
- }
- public String next() {
- while (tokenizer == null || !tokenizer.hasMoreTokens()) {
- try {
- tokenizer = new StringTokenizer(reader.readLine());
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- return tokenizer.nextToken();
- }
- public int nextInt() {
- return Integer.parseInt(next());
- }
- }
- //Main method for all the codes
- public static void main(String[] args) {
- InputStream inputStream = System.in;
- OutputStream outputStream = System.out;
- InputReader in = new InputReader(inputStream);
- PrintWriter out = new PrintWriter(outputStream);
- ProblemSolver problemSolver = new ProblemSolver();
- problemSolver.solveTheProblem(in, out);
- out.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement