17-JSCPC&&CCPC中南赛区 D-Super Resolution-字符串签到

题目链接:http://202.197.224.59/OnlineJudge2/index.php/Problem/read/id/1263
//湘潭CCPC同一套题 竟然没找到JSCPC的地址
实现图形的放大
直接输出

Description
Bobo has an n×m picture consists of black and white pixels. He loves the picture so he would like to scale it a×b times. That is, to replace each pixel with a×b block of pixels with the same color (see the example for clarity).

Input
The input contains zero or more test cases and is terminated by end-of-file. For each test case,

The first line contains four integers n,m,a,b. The i-th of the following n lines contains a binary string of length m which denotes the i-th row of the original picture. Character “0” stands for a white pixel while the character “1” stands for black one.

1≤n,m,a,b≤10
The number of tests cases does not exceed 10.

Output
For each case, output n×a rows and m×b columns which denote the result.

Sample Input
2 2 1 1
10
11
2 2 2 2
10
11
2 2 2 3
10
11

Sample Output
10
11
1100
1100
1111
1111
111000
111000
111111
111111

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mem(s,t) memset(s,t,sizeof(s))
#define D(v) cout<<#v<<" "<<v<<endl
#define inf 0x3f3f3f3f
string arr[15];
int main(){
#ifdef LOCAL
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    //发现湘潭大学这个宏会出错..OJ比较伤
#endif
    int n,m,a,b;
    while(cin>>n>>m>>a>>b){
        for(int i=0;i<n;i++){
            cin>>arr[i];
        }
        for(int i=0;i<n*a;i++){
            for(int j=0;j<m*b;j++){
                cout<<arr[i/a][j/b];
            }
            puts("");
        }
    }
    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值