/ OPS / 题库 /

Repeating Characters

Repeating Characters

#描述#
<span><span style="font-family:Times font-size:14px;">For this problem, you will write a program that takes a string of characters, </span><strong><span style="color:#E53333;font-family:Times font-size:14px;">S</span></strong><span style="font-family:Times font-size:14px;">, and creates a new string of characters, </span><strong><span style="color:#E53333;font-family:Times font-size:14px;">T</span></strong><span style="font-family:Times font-size:14px;">, with each character repeated </span><strong><span style="color:#E53333;font-family:Times font-size:14px;">R</span></strong><span style="font-family:Times font-size:14px;"> times. That is, </span><strong><span style="color:#E53333;font-family:Times font-size:14px;">R</span></strong><span style="font-family:Times font-size:14px;"> copies of the first character of </span><strong><span style="color:#E53333;font-family:Times font-size:14px;">S</span></strong><span style="font-family:Times font-size:14px;">, followed by </span><strong><span style="color:#E53333;font-family:Times font-size:14px;">R</span></strong><span style="font-family:Times font-size:14px;"> copies of the second character of </span><strong><span style="color:#E53333;font-family:Times font-size:14px;">S</span></strong><span style="font-family:Times font-size:14px;">, and so on. Valid characters for </span><strong><span style="color:#E53333;font-family:Times font-size:14px;">S</span></strong><span style="font-family:Times font-size:14px;"> are the </span><strong><span style="color:#E53333;font-family:Times font-size:14px;">QR</span></strong><span style="font-family:Times font-size:14px;"> Code "alphanumeric" characters:</span></span><br />
<div style="text-align:center;">
<span class="Apple-style-span" style="font-family:Times font-size:14px;">0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$%*+-./:</span>
</div>

#格式#
##输入格式##
The first line of input contains a single integer P, (1 &lt= P &lt= 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 &lt= R &lt= 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.

##输出格式##
The first line of input contains a single integer P, (1 &lt= P &lt= 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 &lt= R &lt= 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.

#样例1#
##样例输入1##

2
1 3 ABC
2 5 /HTP

##样例输出1##

1 AAABBBCCC
2 /////HHHHHTTTTTPPPPP

#限制#
1000ms
32768KB

#提示#

#来源#
Greater New York Region

信息

ID
1970
难度
10
分类
category1 点击显示
标签
递交数
1
已通过
0
通过率
0%
上传者