2014-10-31 14:44:33

A:这个。。暴力即可。(cf的a,b基本就考考暴力、贪心,虽然在算法上没什么帮助,但能大大提高代码能力和准确性!)

 1 /*************************************************************************
 2     > File Name: a.cpp
 3     > Author: Nature
 4     > Mail: 564374850@qq.com 
 5     > Created Time: Thu 30 Oct 2014 06:05:05 PM CST
 6 ************************************************************************/
 7 
 8 #include <cstdio>
 9 #include <cstring>
10 #include <cstdlib>
11 #include <cmath>
12 #include <vector>
13 #include <map>
14 #include <set>
15 #include <stack>
16 #include <queue>
17 #include <iostream>
18 #include <algorithm>
19 using namespace std;
20 #define lp (p << 1)
21 #define rp (p << 1|1)
22 #define getmid(l,r) (l + (r - l) / 2)
23 #define MP(a,b) make_pair(a,b)
24 typedef long long ll;
25 const int INF = 1 << 30;
26 
27 char g[5][5];
28 
29 int main(){
30     for(int i = 0; i < 4; ++i)
31         scanf("%s",g[i]);
32     int c1,c2,flag = 0;
33     for(int i = 0; !flag && i < 3; ++i){
34         for(int j = 0; j < 3; ++j){
35             c1 = c2 = 0;
36             if(g[i][j] == '.') c1++;
37             else c2++;
38             if(g[i][j + 1] == '.') c1++;
39             else c2++;
40             if(g[i + 1][j] == '.') c1++;
41             else c2++;
42             if(g[i + 1][j + 1] == '.') c1++;
43             else c2++;
44             if(c1 == 3 || c1 == 4){
45                 flag = 1;
46                 break;
47             }
48             if(c2 == 3 || c2 == 4){
49                 flag = 1;
50                 break;
51             }
52         }
53     }
54     if(flag) printf("YES\n");
55     else printf("NO\n");
56     return 0;
57 }
View Code

相关文章:

  • 2021-06-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
相关资源
相似解决方案