欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1925A.We Got Everything Covered!
We Got Everything Covered!
You are given two positive integers and .
Your task is to find a string such that all possible strings of length that can be formed using the first lowercase English alphabets occur as a subsequence of .
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 is called a subsequence of another string if can be obtained by deleting some (possibly zero) characters from without changing the order of the remaining characters.
Input
The first line of input contains a single integer () denoting the number of test cases.
Each test case consists of a single line of input containing two integers () and ().
Output
For each test case, print a single line containing a single string 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.
Note
For the first test case, there are two strings of length which can be formed using the first lowercase English alphabets, and they are present in as a subsequence as follows:
a}: {\color{red}{\texttt{a}}}\texttt{bb}: \texttt{a}{\color{red}{\texttt{b}}
For the second test case, there is only one string of length which can be formed using the first lowercase English alphabet, and it is present in as a subsequence as follows:
aa}: {\color{red}{\texttt{aa}}
For the third test case, there are strings of length which can be formed using the first lowercase English alphabets, and they are present in as a subsequence as follows:
aa}: \texttt{b}{\color{red}{\texttt{aa}}}\texttt{bab}: \texttt{ba}{\color{red}{\texttt{ab}}ba}: {\color{red}{\texttt{ba}}}\texttt{abbb}: {\color{red}{\texttt{b}}}\texttt{aa}{\color{red}{\texttt{b}}
For the fourth test case, there are strings of length which can be formed using the first lowercase English alphabets, and they are present in as a subsequence as follows:
aa}: {\color{red}{\texttt{a}}}\texttt{bcb}{\color{red}{\texttt{a}}}\texttt{cab}: {\color{red}{\texttt{ab}}}\texttt{cbacac}: \texttt{abcb}{\color{red}{\texttt{ac}}ba}: \texttt{abc}{\color{red}{\texttt{ba}}}\texttt{cbb}: \texttt{a}{\color{red}{\texttt{b}}}\texttt{c}{\color{red}{\texttt{b}}}\texttt{acbc}: \texttt{a}{\color{red}{\texttt{bc}}}\texttt{bacca}: \texttt{ab}{\color{red}{\texttt{c}}}\texttt{b}{\color{red}{\texttt{a}}}\texttt{ccb}: \texttt{ab}{\color{red}{\texttt{cb}}}\texttt{accc}: \texttt{ab}{\color{red}{\texttt{c}}}\texttt{ba}{\color{red}{\texttt{c}}
Samples
4
1 2
2 1
2 2
2 3
ab
aa
baab
abcbac
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |