CF1092A.Uniform String

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

You are given two integers nn and kk .

Your task is to construct such a string ss of length nn that for each ii from 11 to kk there is at least one ii -th letter of the Latin alphabet in this string (the first letter is 'a', the second is 'b' and so on) and there are no other letters except these. You have to maximize the minimal frequency of some letter (the frequency of a letter is the number of occurrences of this letter in a string). If there are several possible answers, you can print any.

You have to answer tt independent queries.

输入格式

The first line of the input contains one integer tt ( 1t1001 \le t \le 100 ) — the number of queries.

The next tt lines are contain queries, one per line. The ii -th line contains two integers nin_i and kik_i ( 1ni100,1kimin(ni,26)1 \le n_i \le 100, 1 \le k_i \le min(n_i, 26) ) — the length of the string in the ii -th query and the number of characters in the ii -th query.

输出格式

Print tt lines. In the ii -th line print the answer to the ii -th query: any string sis_i satisfying the conditions in the problem statement with constraints from the ii -th query.

输入输出样例

  • 输入#1

    3
    7 3
    4 4
    6 2
    

    输出#1

    cbcacab
    abcd
    baabab
    

说明/提示

In the first example query the maximum possible minimal frequency is 22 , it can be easily seen that the better answer doesn't exist. Other examples of correct answers: "cbcabba", "ccbbaaa" (any permutation of given answers is also correct).

In the second example query any permutation of first four letters is acceptable (the maximum minimal frequency is 11 ).

In the third example query any permutation of the given answer is acceptable (the maximum minimal frequency is 33 ).

首页