Super Resolution

Accepted : 121   Submit : 187
Time Limit : 1000 MS   Memory Limit : 65536 KB 

 

Bobo has an  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

  • 10

  • The number of tests cases does not exceed 10.
  • Output

    For each case, output 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 <stdio.h>
     3 #include <string.h>
     4 using namespace std;
     5 #define MX 205
     6 
     7 int num[MX][MX];
     8 int ans[MX][MX];
     9 
    10 
    11 int main()
    12 {
    13     int n,m,a,b;
    14     while (scanf("%d%d%d%d",&n,&m,&a,&b)!=EOF)
    15     {
    16         for (int i=1;i<=n;i++)
    17         {
    18             char str[20];
    19             scanf("%s",str);
    20             for (int j=1;j<=m;j++)
    21                 num[i][j]=str[j-1]-'0';
    22         }
    23         for (int i=1;i<=n;i++)
    24             for (int j=1;j<=m;j++)
    25                 for (int x=1;x<=a;x++)
    26                     for (int y=1;y<=b;y++)
    27                         ans[(i-1)*a+x][(j-1)*b+y]=num[i][j];
    28         for (int i=1;i<=n*a;i++)
    29         {
    30             for (int j=1;j<=m*b;j++)
    31                 printf("%d",ans[i][j]);
    32             putchar(10);
    33         }
    34     }
    35     return 0;
    36 }
    View Code

     

    相关文章:

    • 2022-01-02
    • 2021-07-15
    • 2021-12-12
    • 2021-10-19
    • 2021-07-24
    • 2021-04-12
    • 2021-04-21
    • 2022-01-29
    猜你喜欢
    • 2021-07-09
    • 2021-06-16
    • 2021-05-04
    • 2021-05-19
    • 2022-01-10
    • 2021-10-13
    • 2021-11-29
    相关资源
    相似解决方案