Codeforces 707A. Brain's Photos

题目链接:http://codeforces.com/problemset/problem/707/A

题意:

  给你一个 n * m 的照片, 让你判断这个照片是否是黑白的,其中如果一个照片仅由"W", "B", "G"组成, 那么就可以说它是黑白的.

代码:

 1 #include <bits/stdc++.h>
 2
 3 using namespace std;
 4
 5 typedef long long LL;
 6 const double PI = acos(-1);
 7
 8 int main() {
 9     ios_base::sync_with_stdio(0); cin.tie(0);
10     int n, m; cin >> n >> m;
11     char c;
12     int ok = 0;
13     for(int i = 0; i < n; i++) {
14         for(int j = 0; j < m; j++) {
15             cin >> c;
16             if(c != ‘W‘ && c != ‘B‘ && c != ‘G‘) ok = 1;
17         }
18     }
19     if(!ok) cout << "#Black&White" <<endl;
20     else cout << "#Color" <<endl;
21     return 0;
22 }

Codeforces 707A. Brain's Photos

时间: 2024-10-19 08:12:31

Codeforces 707A. Brain's Photos的相关文章

CodeForces 707A Brain&#39;s Photos (水题)

题意:给一张照片的像素,让你来确定是黑白的还是彩色的. 析:很简单么,如果有一种颜色不是黑白灰,那么就一定是彩色的. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <iostream> #i

【模拟】Codeforces 707A Brain&#39;s Photos

题目链接: http://codeforces.com/problemset/problem/707/A 题目大意: 给一张N*M的图,只有六种颜色(如下),只含B,W,G的是黑白图,否则是彩色图.问这张图是什么图. 'C' (cyan) 'M' (magenta) 'Y' (yellow) 'W' (white) 'G' (grey) 'B' (black) 题目思路: [模拟] 签到题.直接mark记一下是否出现彩色即可. 1 // 2 //by coolxxx 3 //#include<b

codeforces 707A A. Brain&#39;s Photos(水题)

题目链接: A. Brain's Photos 题意: 问是黑白还是彩色; 思路: 没有思路: AC代码: #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <bits/stdc++.h> #include <stack> #include <map> u

Codeforces Round #368 (Div. 2) Brain&#39;s Photos

Brain's Photos 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

【Codeforces 368A】Brain&#39;s Photos 水题

黑白灰都是#Black&White #include <cstdio> int n,m; int main() { scanf("%d%d",&n,&m); int ok=0; for(int i=0;i<n;i++) for(int j=0;j<m;j++) { char s[5]; scanf("%s",s); if(s[0]!='W'&&s[0]!='B'&&s[0]!='G')

codeforces707A:Brain&#39;s Photos

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

codeforces 690C3 Brain Network

simple:并查集一下 #include <vector> #include <iostream> #include <queue> #include <cmath> #include <map> #include <cstring> #include <algorithm> #include <cstdio> using namespace std; typedef long long LL; const

CodeForces 690C2 Brain Network (medium)(树上DP)

题意:给定一棵树中,让你计算它的直径,也就是两点间的最大距离. 析:就是一个树上DP,用两次BFS或都一次DFS就可以搞定.但两次的时间是一样的. 代码如下: #include<bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; vector<int> G[maxn]; int f[maxn], g[maxn], l[maxn]; int dfs(int root, int fa){ if(f[root] !=

CodeForces 690C1 Brain Network (easy) (水题,判断树)

题意:给定 n 条边,判断是不是树. 析:水题,判断是不是树,首先是有没有环,这个可以用并查集来判断,然后就是边数等于顶点数减1. 代码如下: #include <bits/stdc++.h> using namespace std; const int maxn =1000 + 5; int p[maxn]; int Find(int x){ return x == p[x] ? x : p[x] = Find(p[x]); } int main(){ int n, m, x, y; cin