zoukankan      html  css  js  c++  java
  • 60: noi.ac #69

    $code$

    #include<iostream>
    #include<cstdio>
    #include<cstdlib>
    #include<cstring>
    #include<climits>
    using namespace std;
    typedef long long LL;
    int n, m;
    char a[110][110];
    bool flg[27];
    inline char getans(int x, int y) {
        char ret = a[x][y];
        if (!ret) {
            ret = 'A';
            while (ret == a[x - 1][y] || ret == a[x + 1][y] || ret == a[x][y - 1] || ret == a[x][y + 1]) ++ ret;
        }
        return ret;
    }
    inline void cover(int x, int y) {
        char c = getans(x, y);
        putchar(c);
        if (a[x][y]) return;
        int sz = 1;
        while(x + sz <= n && y + sz <= m && getans(x, y + sz) == c) {
            sz ++;
        }
        sz --;
        for (int i = x; i <= x + sz; ++ i)
            for (int j = y; j <= y + sz; ++ j)
                a[i][j] = c;
    }
    
    int main() {
        scanf("%d%d", &n, &m);
        for (int i = 1; i <= n; ++ i) {
            for (int j = 1; j <= m; ++ j)
                cover(i, j);
            putchar('
    ');
        }
    }
  • 相关阅读:
    Docker
    Alfred Workflow
    AWS Lambda
    XPath
    WebMagic
    Splash
    Selenium
    代理服务器
    JSONPath
    Sqlserver 查询分组 记录
  • 原文地址:https://www.cnblogs.com/shandongs1/p/9904367.html
Copyright © 2011-2022 走看看