YTU 2903: A--A Repeating Characters
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
#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的更多相关文章
- LeetCode[3] Longest Substring Without Repeating Characters
题目描述 Given a string, find the length of the longest substring without repeating characters. For exam ...
- [LeetCode] Longest Substring with At Least K Repeating Characters 至少有K个重复字符的最长子字符串
Find the length of the longest substring T of a given string (consists of lowercase letters only) su ...
- [LeetCode] Longest Substring Without Repeating Characters 最长无重复子串
Given a string, find the length of the longest substring without repeating characters. For example, ...
- Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. Examples: Giv ...
- 3. Longest Substring Without Repeating Characters(c++) 15ms
Given a string, find the length of the longest substring without repeating characters. Examples: Giv ...
- 【leetcode】Longest Substring Without Repeating Characters
题目描述: Given a string, find the length of the longest substring without repeating characters. For exa ...
- Longest Substring Without Repeating Characters(C语言实现)
Given a string, find the length of the longest substring without repeating characters. Examples: Giv ...
- leetcode: longest substring without repeating characters
July 16, 2015 Problem statement: Longest Substring Without Repeating Characters Read the blog: http: ...
- [LeetCode_3] Longest Substring Without Repeating Characters
LeetCode: 3. Longest Substring Without Repeating Characters class Solution { public: int lengthOfLon ...
随机推荐
- Java关于条件判断练习--统计一个src文件下的所有.java文件内的代码行数(注释行、空白行不统计在内)
要求:统计一个src文件下的所有.java文件内的代码行数(注释行.空白行不统计在内) 分析:先封装一个静态方法用于统计确定的.java文件的有效代码行数.使用字符缓冲流读取文件,首先判断是否是块注释 ...
- pip安装requests库失败
pip install 安装第三方插件是出现Could not fetch URL https://pypi.python.org/simple/pool/: There was a problem ...
- python 监控oracle 数据库
import cx_Oracle import os db = cx_Oracle.connect('**********') print "Show Oracle Version: &qu ...
- Python补充--Python内置函数清单
Python内置函数 Python内置(built-in)函数随着python解释器的运行而创建.在Python的程序中,你可以随时调用这些函数,不需要定义.最常见的内置函数是: print(&quo ...
- Laya 分帧加载优化
Laya 分帧加载优化 @author ixenos Flash中的EnterFrame事件在Laya中等同于Laya.timer.frameLoop(1,...) Laya.timer.frameL ...
- BZOJ 2763: [JLOI2011]飞行路线 【SPFA】
Alice和Bob现在要乘飞机旅行,他们选择了一家相对便宜的航空公司.该航空公司一共在n个城市设有业务,设这些城市分别标记为0到n-1,一共有m种航线,每种航线连接两个城市,并且航线有一定的价格.Al ...
- 【搜索】codeforces C. The Tag Game
http://codeforces.com/contest/813/problem/C [题意] 给定一棵有n个结点的树,初始时Alice在根结点1,Bob在非根结点x; Alice和Bob轮流走,每 ...
- vagrant的学习 之 Yii2
vagrant的学习 之 Yii2 本文根据慕课网的视频教程练习,感谢慕课网! 慕课视频学习地址:https://www.imooc.com/video/14218. 慕课的参考文档地址:https: ...
- Java添加、提取、替换和删除PDF图片
(一)简介 这篇文章将介绍在Java中添加.提取.删除和替换PDF文档中的图片. 工具使用: Free Spire.PDF for JAVA 2.4.4(免费版) Intellij IDEA Jar包 ...
- Java实现网页截屏
原文:http://www.open-open.com/code/view/1424006089452 import java.awt.AWTException; import java.awt.De ...