日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

YTU 2903: A--A Repeating Characters

發(fā)布時間:2023/12/1 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 YTU 2903: A--A Repeating Characters 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

2903: A--A Repeating Characters

時間限制:?1 Sec??內(nèi)存限制:?128 MB
提交:?50??解決:?30

題目描述

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 copies 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:
???? 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$%*+-. /:

輸入

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 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.

輸出

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

樣例輸入

2 1 3 ABC 2 5 /HTP

樣例輸出

1 AAABBBCCC 2 /HHHHHTTTTTPPPPP


im0qianqian_站在回憶的河邊看著搖晃的渡船終年無聲地擺渡,它們就這樣安靜地畫下黃昏畫下清晨......

#include <string.h> #include <stdio.h> int main() {int P,N,num,i=0,j,k;char c[20];scanf("%d",&P);for(k=0; k<P; k++,i=0,puts("")){scanf("%d%d %s",&N,&num,c);printf("%d ",N);for(; c[i]!='\0'; i++)for (j=1; j<=num; j++)printf("%c",c[i]);}return 0; }

轉(zhuǎn)載于:https://www.cnblogs.com/im0qianqian/p/5989666.html

總結(jié)

以上是生活随笔為你收集整理的YTU 2903: A--A Repeating Characters的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。