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;
}
Codeforces Round #368 (Div. 2) A. Brain's Photos (水题)的更多相关文章
- 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 ...
- Codeforces Round #297 (Div. 2)A. Vitaliy and Pie 水题
Codeforces Round #297 (Div. 2)A. Vitaliy and Pie Time Limit: 2 Sec Memory Limit: 256 MBSubmit: xxx ...
- Codeforces Round #290 (Div. 2) A. Fox And Snake 水题
A. Fox And Snake 题目连接: http://codeforces.com/contest/510/problem/A Description Fox Ciel starts to le ...
- Codeforces Round #322 (Div. 2) A. Vasya the Hipster 水题
A. Vasya the Hipster Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/p ...
- Codeforces Round #373 (Div. 2) B. Anatoly and Cockroaches 水题
B. Anatoly and Cockroaches 题目连接: http://codeforces.com/contest/719/problem/B Description Anatoly liv ...
- Codeforces Round #359 (Div. 2) A. Free Ice Cream 水题
A. Free Ice Cream 题目连接: http://www.codeforces.com/contest/686/problem/A Description After their adve ...
- Codeforces Round #355 (Div. 2) A. Vanya and Fence 水题
A. Vanya and Fence 题目连接: http://www.codeforces.com/contest/677/problem/A Description Vanya and his f ...
- Codeforces Round #384 (Div. 2) A. Vladik and flights 水题
A. Vladik and flights 题目链接 http://codeforces.com/contest/743/problem/A 题面 Vladik is a competitive pr ...
- Codeforces Round #379 (Div. 2) D. Anton and Chess 水题
D. Anton and Chess 题目连接: http://codeforces.com/contest/734/problem/D Description Anton likes to play ...
随机推荐
- LA 2678 Subsequence
有一个正整数序列,求最短的子序列使得其和大于等于S,并输出最短的长度. 用数组b[i]存放序列的前i项和,所以b[i]是递增的. 遍历终点j,然后在区间[0, j)里二分查找满足b[j]-b[i]≥S ...
- ISO中AFN的使用步骤
1.依赖的框架 * MobileCoreServices.framework * SystemConfiguration.framework * Security.framework 2.主头文件:A ...
- win7下的IP-主机名映射
今天学了个技巧,win7下有个目录:C:\Windows\System32\drivers\etc 该目录下有个文件: hosts 在这个文件里面我们可以映射IP-主机名: 127.0.0.1 loc ...
- unity, setting standard shader by script
http://forum.unity3d.com/threads/change-standard-shader-render-mode-in-runtime.318815/
- 【转】IOS开发:[1]Xcode5界面入门
ios开发离不开xcode,这篇以xcode5界面来介绍一下xcode的界面都有哪些内容. 工具/原料 xcode5 整体来看区域有哪些? 1 首先我们先整体来看一下,xcode5界面可以分为五大主要 ...
- 如何用HTML5+PhoneGap写个Path项目
最近Path这个应用很火爆,网上也出现了不少仿Path菜单的项目.即使在原生APP里边,Path的效果也是非常赞的.我突然想,Web APP是不是也能做出类似Path那样的效果呢?于是就有了OPath ...
- 嵌入式 hi3518平台获取网关
</pre><pre code_snippet_id="495447" snippet_file_name="blog_20141024_1_70650 ...
- ECSide标签属性说明之<ec:column>
<ec:column>标签 ◆ 属性: columnId描述: 单元格的id,相当于<td>的id属性 ◆ 属性: title描述: 列在列表表头里显示的名称. ◆ 属性: p ...
- SPF详解
什么是SPF? 这里的SPF不是防晒指数,而是指Sender Policy Framework.翻译过来就是发信者策略架构,比较拗口,通常都直接称为SPF. SPF是跟DNS相关的一项技术,它的内容写 ...
- Zabbix监控Linux磁盘I/O
东西都上传到这里了: https://github.com/RexKang/Zabbix/tree/master/OS/Linux-disk-discovery 需要用到的东西: Zabbix的L ...