311079: CF1931A. Recovering a Small String

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Recovering a Small Stringtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Nikita had a word consisting of exactly $3$ lowercase Latin letters. The letters in the Latin alphabet are numbered from $1$ to $26$, where the letter "a" has the index $1$, and the letter "z" has the index $26$.

He encoded this word as the sum of the positions of all the characters in the alphabet. For example, the word "cat" he would encode as the integer $3 + 1 + 20 = 24$, because the letter "c" has the index $3$ in the alphabet, the letter "a" has the index $1$, and the letter "t" has the index $20$.

However, this encoding turned out to be ambiguous! For example, when encoding the word "ava", the integer $1 + 22 + 1 = 24$ is also obtained.

Determine the lexicographically smallest word of $3$ letters that could have been encoded.

A string $a$ is lexicographically smaller than a string $b$ if and only if one of the following holds:

  • $a$ is a prefix of $b$, but $a \ne b$;
  • in the first position where $a$ and $b$ differ, the string $a$ has a letter that appears earlier in the alphabet than the corresponding letter in $b$.
Input

The first line of the input contains a single integer $t$ ($1 \le t \le 100$) — the number of test cases in the test.

This is followed by the descriptions of the test cases.

The first and only line of each test case contains an integer $n$ ($3 \le n \le 78$) — the encoded word.

Output

For each test case, output the lexicographically smallest three-letter word that could have been encoded on a separate line.

ExampleInput
5
24
70
3
55
48
Output
aav
rzz
aaa
czz
auz

Output

题目大意:
Nikita 有一个由恰好3个拉丁字母小写字母组成的单词。拉丁字母中的字母从1到26编号,其中字母 "a" 的索引为1,字母 "z" 的索引为26。他将这个单词编码为字母表中所有字符位置的求和。例如,单词 "cat" 的编码整数是 3 + 1 + 20 = 24,因为字母 "c" 在字母表中的索引是3,字母 "a" 的索引是1,字母 "t" 的索引是20。然而,这种编码方法存在歧义!例如,当编码单词 "ava" 时,整数 1 + 22 + 1 = 24 也会得到。确定可以编码的3个字母的字典序最小的单词。

输入输出数据格式:
输入:
第一行包含一个整数 t(1 ≤ t ≤ 100)——测试用例的数量。
接下来是测试用例的描述。
每个测试用例的第一行也是唯一一行包含一个整数 n(3 ≤ n ≤ 78)——编码后的单词。

输出:
对于每个测试用例,输出可以编码的字典序最小的3个字母单词,每个测试用例的结果占一行。

示例:
输入:
```
5
24
70
3
55
48
```
输出:
```
aav
rzz
aaa
czz
auz
```题目大意: Nikita 有一个由恰好3个拉丁字母小写字母组成的单词。拉丁字母中的字母从1到26编号,其中字母 "a" 的索引为1,字母 "z" 的索引为26。他将这个单词编码为字母表中所有字符位置的求和。例如,单词 "cat" 的编码整数是 3 + 1 + 20 = 24,因为字母 "c" 在字母表中的索引是3,字母 "a" 的索引是1,字母 "t" 的索引是20。然而,这种编码方法存在歧义!例如,当编码单词 "ava" 时,整数 1 + 22 + 1 = 24 也会得到。确定可以编码的3个字母的字典序最小的单词。 输入输出数据格式: 输入: 第一行包含一个整数 t(1 ≤ t ≤ 100)——测试用例的数量。 接下来是测试用例的描述。 每个测试用例的第一行也是唯一一行包含一个整数 n(3 ≤ n ≤ 78)——编码后的单词。 输出: 对于每个测试用例,输出可以编码的字典序最小的3个字母单词,每个测试用例的结果占一行。 示例: 输入: ``` 5 24 70 3 55 48 ``` 输出: ``` aav rzz aaa czz auz ```

加入题单

上一题 下一题 算法标签: