CF432E.Square Tiling

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You have an n×mn×m rectangle table, its cells are not initially painted. Your task is to paint all cells of the table. The resulting picture should be a tiling of the table with squares. More formally:

  • each cell must be painted some color (the colors are marked by uppercase Latin letters);
  • we will assume that two cells of the table are connected if they are of the same color and share a side; each connected region of the table must form a square.

Given nn and mm , find lexicographically minimum coloring of the table that meets the described properties.

输入格式

The first line contains two integers, nn and mm (1<=n,m<=100)(1<=n,m<=100) .

输出格式

Print lexicographically minimum coloring of the table that meets the described conditions.

One coloring (let's call it X) is considered lexicographically less than the other one (let's call it Y), if:

  • consider all the table cells from left to right and from top to bottom (first, the first cell in the first row, then the second cell in the first row and so on);
  • let's find in this order the first cell that has distinct colors in two colorings;
  • the letter that marks the color of the cell in X, goes alphabetically before the letter that marks the color of the cell in Y.

输入输出样例

  • 输入#1

    1 3
    

    输出#1

    ABA
    
  • 输入#2

    2 2
    

    输出#2

    AA
    AA
    
  • 输入#3

    3 4
    

    输出#3

    AAAB
    AAAC
    AAAB
    
首页