The Cow-Signal

【Description】
Bessie and her cow friends are playing as their favorite cow superheroes. Of course, everyone knows that any self-respecting superhero needs a signal to call them to action. Bessie has drawn a special signal on a sheet of M×N paper (1≤M≤10,1≤N≤10), but this is too small, much too small! Bessie wants to amplify the signal so it is exactly K times bigger (1≤K≤10) in each direction.
The signal will consist only of the ‘.’ and ‘X’ characters.
【Input】
The first line of input contains M, N, and K, separated by spaces.
The next M lines each contain a length-N string, collectively describing the picture of the signal.
【Output】
You should output KM lines, each with KN characters, giving a picture of the enlarged signal.
【Sample Input】
5 4 2
XXX.
X..X
XXX.
X..X
XXX.
【Sample Output】
XXXXXX..
XXXXXX..
XX….XX
XX….XX
XXXXXX..
XXXXXX..
XX….XX
XX….XX
XXXXXX..
XXXXXX..
【题意简述】
给出一个N*M的由X和.组成的图片,将其放大至原来的K倍。
【分析】
从数据范围就可以看出是模拟。

#include<string>
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int n,m,t;
    char a[20][20],b[200];
    scanf("%d%d%d",&n,&m,&t);
    for (int i=0;i<n;i++) cin>>a[i];
    for (int i=0;i<n;i++){
        for (int j=0;j<200;j++) b[j]='!';
        for (int j=0;j<m;j++){
            b[j*t]=a[i][j];
          for (int k=1;k<t;k++) b[j*t+k]=b[j*t];
        }
        for (int j=0;j<t;j++){
          for (int k=0;k<m*t;k++) cout<<b[k];
          cout<<endl;
        }
    }
}

转载于:https://www.cnblogs.com/JRX2015U43/p/6533459.html

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值