2017年“嘉杰信息杯” 中国大学生程序设计竞赛全国邀请赛 Super Resolution

Super Resolution

Accepted : 133   Submit : 203
Time Limit : 1000 MS   Memory Limit : 65536 KB 

 

Super Resolution

Bobo has an n×picture consists of black and white pixels. He loves the picture so he would like to scale it a×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.

  • 1n,m,a,b10
  • 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

题意:将n*m的照片放大a*b倍

解法:模拟

复制代码
 1 #include<iostream>
 2 #include<vector>
 3 #include<cstring>
 4 #include<cstdio>
 5 
 6 #define  INF 1000000000
 7 
 8 using namespace std;
 9 int x[300][300];
10 int main()
11 {
12     int n,m,a,b;
13     while(cin>>n>>m>>a>>b)
14     {
15         string s[300];
16         for(int i=0; i<n; i++)
17         {
18             cin>>s[i];
19         }
20 
21         for(int i=0; i<n*a; i++)
22         {
23             for(int j=0; j<m*b; j++)
24             {
25                  cout<<s[i/a][j/b];
26             }
27             cout<<endl;
28         }
29     }
30     return 0;
31 }
复制代码

 

 

posted @   樱花落舞  阅读(643)  评论(0编辑  收藏  举报
编辑推荐:
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
点击右上角即可分享
微信分享提示