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

    Brain's Photos

    题目链接:

    http://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.

    </big>
    
    
     
    
    
    
    
    ##Input
    <big>
    

    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'.

    </big>
    
    
    
    
    
    
    ##Output
    <big>
    

    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.

    </big>
    
    
     
     
    ##Examples
    <big>
    

    input
    2 2
    C M
    Y Y
    output

    Color

    input
    3 2
    W W
    W W
    B B
    output

    Black&White

    input
    1 1
    W
    output

    Black&White

    </big>
    
    
    ##Source
    <big>
    Codeforces Round #368 (Div. 2)
    </big>
    
    
    
    
    <br/>
    ##题意:
    <big>
    判断给出的图形(像素点)是否是有色图形.
    </big>
    
    
    <br/>
    ##题解:
    <big>
    水题. 注意字符的读入、不要漏掉'G'即可.
    </big>
    
    
    
    
    <br/>
    ##代码:
    ``` cpp
    #include <iostream>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <algorithm>
    #include <queue>
    #include <map>
    #include <set>
    #include <stack>
    #include <vector>
    #include <list>
    #define LL long long
    #define eps 1e-8
    #define maxn 1010
    #define mod 100000007
    #define inf 0x3f3f3f3f
    #define mid(a,b) ((a+b)>>1)
    #define IN freopen("in.txt","r",stdin);
    using namespace std;
    
    int n,m;
    char str[550];
    
    int main(int argc, char const *argv[])
    {
        //IN;
    
        while(scanf("%d %d", &n,&m) != EOF)
        {
            bool flag = 1;
            for(int i=1; i<=n; i++) {
                for(int j=1; j<=m; j++) {
                    getchar();
                    char c = getchar();
                    if(c!='W' && c!='B' && c!='G')
                        flag = 0;
                }
            }
    
            if(flag) puts("#Black&White");
            else puts("#Color");
        }
    
        return 0;
    }
    
  • 相关阅读:
    VC下使用Proc连接Oracle数据库
    解决ORACLE账号system被锁和修改密码
    Javascript 操作select控件大全(新增、修改、删除、选中、清空、判断存在等)[转]
    ckeditor用fckeditor的文件管理器实现图片上传
    video 播放多个视频
    web worker 发送Ajax
    对投影纹理映射的一些思考
    一个光线跟踪的简单实例
    【转载】齐次坐标概念&&透视投影变换推导
    今天开通了cnblog
  • 原文地址:https://www.cnblogs.com/Sunshine-tcf/p/5792453.html
Copyright © 2011-2022 走看看