zoukankan      html  css  js  c++  java
  • Codeforces Round #368 (Div. 2) A. Brain's Photos 水题

    A. Brain's Photos

    题目连接:

    http://www.codeforces.com/contest/707/problem/A

    Description

    Small, but very brave, mouse Brain was not accepted to summer school of young villains. He was upset and decided to postpone his plans of taking over the world, but to become a photographer instead.

    As you may know, the coolest photos are on the film (because you can specify the hashtag #film for such).

    Brain took a lot of colourful pictures on colored and black-and-white film. Then he developed and translated it into a digital form. But now, color and black-and-white photos are in one folder, and to sort them, one needs to spend more than one hour!

    As soon as Brain is a photographer not programmer now, he asks you to help him determine for a single photo whether it is colored or black-and-white.

    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)
    The photo is considered black-and-white if it has only white, black and grey pixels in it. If there are any of cyan, magenta or yellow pixels in the photo then it is considered colored.

    Input

    The first line of the input contains two integers n and m (1 ≤ n, m ≤ 100) — the number of photo pixel matrix rows and columns respectively.

    Then n lines describing matrix rows follow. Each of them contains m space-separated characters describing colors of pixels in a row. Each character in the line is one of the 'C', 'M', 'Y', 'W', 'G' or 'B'.

    Output

    Print the "#Black&White" (without quotes), if the photo is black-and-white and "#Color" (without quotes), if it is colored, in the only line.

    Sample Input

    2 2
    C M
    Y Y

    Sample Output

    Color

    Hint

    题意

    给你张照片,告诉你这张照片用了哪些颜色,问你这个照片是彩色照片,还是黑白照片

    题解:

    水题嘛,if判断一下就好了

    代码

    #include<bits/stdc++.h>
    using namespace std;
    
    int n,m;
    string s;
    int main()
    {
        int flag = 0;
        scanf("%d%d",&n,&m);
        for(int i=0;i<n;i++)
            for(int j=0;j<m;j++)
            {
                cin>>s;
                if(s=="C"||s=="M"||s=="Y")
                    flag=1;
            }
        if(flag)printf("#Color
    ");
        else printf("#Black&White
    ");
    }
  • 相关阅读:
    docker创建nginx+php-fpm+mysql环境(一分钟搭建lnmp)
    dcoker搭建wordpress
    docker搭建mysql
    nginx负载均衡精简配置实例
    docker配置阿里云镜像加速
    Centos7 ssh配置RSA证书登录
    Dockerfile centos7_php5.6.36
    Dockerfile cnetos7_nginx1.15.10
    Dockerfile centos7_tomcat7.0.64_jdk7u80
    centos7 安装docker
  • 原文地址:https://www.cnblogs.com/qscqesze/p/5791677.html
Copyright © 2011-2022 走看看