CF1844D.Row Major

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

The row-major order of an r×cr \times c grid of characters AA is the string obtained by concatenating all the rows, i.e. $$$$ A_{11}A_{12} \dots A_{1c}A_{21}A_{22} \dots A_{2c} \dots A_{r1}A_{r2} \dots A_{rc}. $$

A grid of characters AA is bad if there are some two adjacent cells (cells sharing an edge) with the same character.

You are given a positive integer nn . Consider all strings ss consisting of only lowercase Latin letters such that they are not the row-major order of any bad grid. Find any string with the minimum number of distinct characters among all such strings of length nn$$.

It can be proven that at least one such string exists under the constraints of the problem.

输入格式

Each test contains multiple test cases. The first line contains the number of test cases tt ( 1t1041 \le t \le 10^4 ). The description of the test cases follows.

The only line of each test case contains a single integer nn ( 1n1061 \le n \le 10^6 ).

It is guaranteed that the sum of nn over all test cases does not exceed 10610^6 .

输出格式

For each test case, output a string with the minimum number of distinct characters among all suitable strings of length nn .

If there are multiple solutions, print any of them.

输入输出样例

  • 输入#1

    4
    4
    2
    1
    6

    输出#1

    that
    is
    a
    tomato

说明/提示

In the first test case, there are 33 ways ss can be the row-major order of a grid, and they are all not bad:

tththathatat It can be proven that 33 distinct characters is the minimum possible.In the second test case, there are 22 ways ss can be the row-major order of a grid, and they are both not bad:

iiss It can be proven that 22 distinct characters is the minimum possible.In the third test case, there is only 11 way ss can be the row-major order of a grid, and it is not bad.

In the fourth test case, there are 44 ways ss can be the row-major order of a grid, and they are all not bad:

ttotomtomatoomaatomtoato It can be proven that 44 distinct characters is the minimum possible. Note that, for example, the string "orange" is not an acceptable output because it has 6>46 > 4 distinct characters, and the string "banana" is not an acceptable output because it is the row-major order of the following bad grid: banana

首页