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.

样例输入

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;
}

转载于:https://www.cnblogs.com/im0qianqian/p/5989666.html

YTU 2903: A--A Repeating Characters相关推荐

  1. LeetCode.3-最长无重复字符子串(Longest Substring Without Repeating Characters)

    这是悦乐书的第341次更新,第365篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Medium级别的第2题Longest Substring Without Repeating Cha ...

  2. 3.longest substring without repeating characters

    Given a string, find the length of the longest substring without repeating characters. Example 1: In ...

  3. [LeetCode]3.Longest Substring Without Repeating Characters

    [题目] Given a string, find the length of the longest substring without repeating characters. For exam ...

  4. LeetCode---------Longest Substring Without Repeating Characters解法

    题目如下: Given a string, find the length of the longest substring without repeating characters. Example ...

  5. LeetCode: 3_Longest Substring Without Repeating Characters | 求没有重复字符的最长子串的长度 | Medium...

    题目: Given a string, find the length of the longest substring without repeating characters. For examp ...

  6. Longest Substring Without Repeating Characters(最长不重复子序列求解)

    问题描述: Given a string, find the length of the longest substring without repeating characters. Example ...

  7. [LeetCode] Longest Substring Without Repeating Characters

    Given a string, find the length of the longest substring without repeating characters. For example, ...

  8. LeetCode——Longest Substring Without Repeating Characters

    原问题 Given a string, find the length of the longest substring without repeating characters. Example 1 ...

  9. LeetCode:3. Longest Substring Without Repeating Characters

    https://leetcode.com/problems/longest-substring-without-repeating-characters/description/ 内容描述: Give ...

最新文章

  1. linux 编译mqtt静态库_编译MQTT C++ Client
  2. promise 和 async await区别
  3. python中的浮点数用法_如何利用Python在运算后得到浮点数值的方法详解
  4. centos7 ldap php,php7安装ldap扩展
  5. 移动通信—无线波传播
  6. java 字面值_Java基础之字面值
  7. GS认证、VDE认证、CE认证简单介绍
  8. 使用 Entity Framework Power Tool 报错 0×80070057 解决方法
  9. 腾云忆想构建云化IT生态,助力我国“双循环经济”数字化升级
  10. 卸甲归田——回顾CSP2019
  11. 前端—react项目及版本更新对比
  12. 火车订票管理系统/火车购票网站系统/火车订票网站/火车票售卖系统
  13. android最新版本6,keep安卓官方最新版
  14. Project build error: Non-parseable POM D:\code\pom.xml: expected start tag name and not
  15. css+div如何解决内容的溢出
  16. 无效的JSON Web令牌
  17. Linux基础篇之网络配置
  18. 系统光盘内容怎么考到计算机里,怎么把光盘内容复制到电脑上
  19. c语言1999国际标准,月光软件站 - 编程文档 - 软件工程 - C语言国际标准 ISO/IEC 9899:1999(E) 翻译(一):目录...
  20. C++游戏系列——音符游戏(1)

热门文章

  1. JQUERY操作html--获取和设置内容、属性、回调函数
  2. eclipse中tomcat能正常启动,在浏览器中不能打开问题
  3. 青禾BBS数据库查询语句(动网)
  4. mediawiki自动生成sitemap
  5. 2008Beta 版AJAX的一个奇怪的问题
  6. ABAP--关于ABAP流程处理的一些命令的说明(stop,exit,return,check,reject)
  7. OpenCV cvLine
  8. python api是什么_Python/C API
  9. Matlab找矩阵中最大最小值的位置
  10. xfs支持oracle,让linux内核支持xfs文件系统