zoukankan      html  css  js  c++  java
  • 【HDOJ】1760 A New Tetris Game

    博弈,主要是求SG值。终于做出点儿感觉。

     1 /* 1760 */
     2 #include <cstdio>
     3 #include <cstring>
     4 #include <cstdlib>
     5 
     6 #define MAXN 55
     7 
     8 char map[MAXN][MAXN];
     9 int n, m;
    10 
    11 int cal_SG() {
    12     int i, j, k, r, p;
    13     
    14     for (i=0; i<n-1; ++i) {
    15         for (j=0; j<m-1; ++j) {
    16             if (map[i][j]=='0' && map[i][j+1]=='0' && map[i+1][j]=='0' && map[i+1][j+1]=='0') {
    17                 map[i][j] = map[i][j+1] = map[i+1][j] = map[i+1][j+1] = '1';
    18                 k = cal_SG();
    19                 map[i][j] = map[i][j+1] = map[i+1][j] = map[i+1][j+1] = '0';
    20                 if (k == 0)
    21                     return 1;
    22             }
    23         }
    24     }
    25     return 0;
    26 }
    27 
    28 int main() {
    29     int i, j, k;
    30     
    31     #ifndef ONLINE_JUDGE
    32         freopen("data.in", "r", stdin);
    33     #endif
    34     
    35     while (scanf("%d %d", &n, &m) != EOF) {
    36         for (i=0; i<n; ++i)
    37             scanf("%s", map[i]);
    38         if (cal_SG() == 0)
    39             puts("No");
    40         else
    41             puts("Yes");
    42     }
    43     
    44     return 0;
    45 }
  • 相关阅读:
    Annotation
    injector
    Java容器(container)
    build tool(构建工具)maven和gradle安装方法
    version control(版本控制)
    函数式编程
    URI与URL
    超文本传输协议HTTP
    annotation的理解
    Injection
  • 原文地址:https://www.cnblogs.com/bombe1013/p/4257385.html
Copyright © 2011-2022 走看看