题库练习 We Got Everything Covered!
← 上一题 下一题 →

A11353 | We Got Everything Covered!

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

You are given two positive integers $n$ and $k$ .

Your task is to find a string $s$ such that all possible strings of length $n$ that can be formed using the first $k$ lowercase English alphabets occur as a subsequence of $s$ .

If there are multiple answers, print the one with the smallest length. If there are still multiple answers, you may print any of them.

Note: A string $a$ is called a subsequence of another string $b$ if $a$ can be obtained by deleting some (possibly zero) characters from $b$ without changing the order of the remaining characters.

输入格式

The first line of input contains a single integer $t$ ( $1\leq t\leq 676$ ) denoting the number of test cases.

Each test case consists of a single line of input containing two integers $n$ ( $1\leq n\leq 26$ ) and $k$ ( $1\leq k\leq 26$ ).

输出格式

For each test case, print a single line containing a single string $s$ which satisfies the above property. If there are multiple answers, print the one with the smallest length. If there are still multiple answers, you may print any of them.

输入输出样例

输入 #1
4
1 2
2 1
2 2
2 3
输出 #1
ab
aa
baab
abcbac
C++ 编辑器
输入
输出