YTU 2903: A--A Repeating Characters
来源:互联网 发布:python 模块初始化 编辑:程序博客网 时间:2024/05/17 07:56
2903: A--A Repeating Characters
时间限制: 1 Sec 内存限制: 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.
样例输入
21 3 ABC2 5 /HTP
样例输出
1 AAABBBCCC2 /////HHHHHTTTTTPPPPP
#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;}
- YTU 2903: A--A Repeating Characters
- ytu Problem A: A--A Repeating Characters师创杯
- YTUOJ-A--A Repeating Characters
- Contest1376 - "师创杯"烟台大学第二届ACM程序设计精英赛复现 A--A Repeating Characters
- Find the first non-repeating character from a stream of characters
- leetcode Longest Substring Without Repeating Characters Description: Given a string, find the leng
- Given a string, find the length of the longest substring without repeating characters
- YTU 1012: A MST Problem
- YTU 2547: Repairing a Road
- YTU 1001: A+B Problem
- YTU 2900: F-A Simple Question
- YTU 2953: A代码填充--学画画
- YTU 2844: 改错题A-看电影
- YTU 2614: A代码完善--系统日期
- ytu 2614 A代码完善--系统日期
- Dived a larger characters file
- Unique Characters of a String
- YTU-OJ-Problem A: A代码完善--向量的运算
- 学习笔记------数据结构(C语言版) 静态链表
- setup nfs server
- Python缩进快捷键
- Syntax error on tokens, delete these tokens
- unixODBC without the GUI
- YTU 2903: A--A Repeating Characters
- 浅谈Java序列化
- 菜鸟之路-浅谈设计模式之工厂模式
- iOS 生成随机数方法
- 重拾编程之路--直接选择排序算法
- 来自西弗吉利亚大学li xin整理的CV代码合集
- cocos2dx之ndk用release模式编译
- Html5添加移动手机和桌面设备使用的模块化JavaScript图片画廊插件教程
- 系统自带JSonObject解析