您的位置:首页 > 大数据 > 人工智能

Codeforces Round #368 (Div. 2) A. Brain's Photos (水题)

2016-08-21 12:14 363 查看
原文链接:https://www.geek-share.com/detail/2682752841.html

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.

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.

Examples

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

Source


Codeforces Round #368 (Div. 2)


题意:


判断给出的图形(像素点)是否是有色图形.


题解:


水题. 注意字符的读入、不要漏掉'G'即可.


代码:

#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;
}
[/code]

转载于:https://www.cnblogs.com/Sunshine-tcf/p/5792453.html

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: