22742_RepeatingCharacters

2022-5-16 18:22| 发布者: Hocassian| 查看: 29| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506914221400-Problem List-采集的数据-后羿采集器.html

Pro.ID

22742

Title

Repeating Characters

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22742

AC

35

Submit

80

Ratio

43.75%

时间&空间限制

  • Time Limit: 0/0 MS (Java/Others)     Memory Limit: 0/0 K (Java/Others)
  • 描述

    For this problem, you will write a program that takes a string of characters, S, and creates a new string of characters, T, with each character repeated R times. That is, R coyies of the first character of S, followed by R copies of the second character of S, and so on. Valid characters for S are the QR Code "alphanumeric" characters:

    0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z $ % * + - . / :

    输入

    The first line of input contains a single integer P, ( 1 ≤ P ≤ 1000 ), which is the number of data sets that follow. Each data set is a single line of input consisting of the data set number N, followed by a space, followed by the repeat count R, ( 1 ≤ R ≤ 8 ), followed by a space, followed by the string S. The length of string S will always be at least one and no more than 20 characters. All the characters will be from the set of characters shown above.

    输出

    Description

    For this problem, you will write a program that takes a string of characters, S, and creates a new string of characters, T, with each character repeated R times. That is, R coyies of the first character of S, followed by R copies of the second character of S, and so on. Valid characters for S are the QR Code "alphanumeric" characters:

    0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z $ % * + - . / :

    Input

    The first line of input contains a single integer P, ( 1 ≤ P ≤ 1000 ), which is the number of data sets that follow. Each data set is a single line of input consisting of the data set number N, followed by a space, followed by the repeat count R, ( 1 ≤ R ≤ 8 ), followed by a space, followed by the string S. The length of string S will always be at least one and no more than 20 characters. All the characters will be from the set of characters shown above.

    Output

    For each data set there is one line of output. It contains the data set number, N, followed by a single space which is then followed by the new string T, which is made of each character in S repeated R times.

    Sample Input

    2
    1 3 ABC
    2 5 /HTP

    Sample Output

    1 AAABBBCCC
    2 /////HHHHHTTTTTPPPPP

    Hint

    请忽略本题。

    Source

    样例输入

    2
    1 3 ABC
    2 5 /HTP

    样例输出

    1 AAABBBCCC
    2 /////HHHHHTTTTTPPPPP

    提示

    请忽略本题。


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部