zoukankan      html  css  js  c++  java
  • 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
    


    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]!=''; i++)
                for (j=1; j<=num; j++)
                    printf("%c",c[i]);
        }
        return 0;
    }
    


  • 相关阅读:
    segnet 编译与测试
    ubuntu(已经配置了python2+opencv)简易配置python3的opencv:
    OCR光学字符识别--STN-OCR 测试
    阿里云图形界面
    win10+UEFI下u盘安装ubuntu16.04
    ubuntu16.04+cuda8.0+cudnn5.0+caffe
    Angular 组件通讯、生命周期钩子 小结
    Angular 路由⑦要素
    关于克隆gitlab项目的一些 问题列表
    RxJS学习笔记
  • 原文地址:https://www.cnblogs.com/im0qianqian/p/5989666.html
Copyright © 2011-2022 走看看