题意:给一张照片的像素,让你来确定是黑白的还是彩色的。
析:很简单么,如果有一种颜色不是黑白灰,那么就一定是彩色的。
代码如下:
#pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <iostream> #include <cstring> #include <set> #include <queue> #include <algorithm> #include <vector> #include <map> #include <cctype> #include <stack> using namespace std ; typedef long long LL; typedef pair<int, int> P; const int INF = 0x3f3f3f3f; const double inf = 0x3f3f3f3f3f3f; const double PI = acos(-1.0); const double eps = 1e-10; const int maxn = 2e5 + 5; const int mod = 1e9 + 7; const char *mark = "+-*"; const int dr[] = {-1, 0, 1, 0}; const int dc[] = {0, 1, 0, -1}; int n, m; inline int Min(int a, int b){ return a < b ? a : b; } inline int Max(int a, int b){ return a > b ? a : b; } inline LL Min(LL a, LL b){ return a < b ? a : b; } inline LL Max(LL a, LL b){ return a > b ? a : b; } inline bool is_in(int r, int c){ return r >= 0 && r < n && c >= 0 && c < m; } int main(){ while(scanf("%d %d", &n, &m) == 2){ char s[10]; int cnt1 = 0, cnt2 = 0; for(int i = 0; i < n; ++i){ for(int j = 0; j < m; ++j){ scanf("%s", s); if(s[0] == 'B' || s[0] == 'G' || s[0] == 'W') ++cnt1; else ++cnt2; } } if(cnt2) puts("#Color"); else puts("#Black&White"); } return 0; }