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

http://codeforces.com/problemset/problem/707/A

题意:判断一副图片是黑白的还是彩色的。

PS:
n行m列。每个像素点之间有空格。
所以用字符串输入并不方便。

最简单的还可以

1
2
i < n * m。
然后挨个输入 char

代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <bits/stdc++.h>
using namespace std;

int main() {
int n, m, sign = 0;
cin >> n >> m;
char c;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> c;
if (c == 'C' || c == 'M' || c == 'Y') {
sign = 1;
break;
}
}
}
if (sign) { printf("%s\n", "#Color"); }
else { printf("%s\n", "#Black&White"); }
return 0;
};