'convert image size into required ratio

hello i want to solve how can i solve this problem We all know that a raster graphic image represents by a rectangular grid of pixels. Whenever we zoom-in or zoom-out, actually we are not changing original image but repeat its pixels to create a larger picture reflecting original picture.

Here we are facing similar problem. Zafar is working similar kind of structure but his images are created by using ASCII codes. He wants to write a program to enlarge or shrink pictures up to required ratio. Input specification: The first line of input contains an integer ‘n’ where 0 < n < 100 which represents the number of images. Each case starts with two integers ‘r’ and ’q’ where 0 < r & m < 100. The next ‘r’ lines contain exact ‘r ‘characters separated by a space.

Output specification: You must write exact ‘q’ lines containing ‘q’ characters separated by a space and reflecting original matrix or write ‘Not possible’ when original picture can’t be reflected in required size. Sample Input: 2

2 4

  • 0

0 +

2 3

  • 0

0 +

Output for Sample Input:

    • 0 0
    • 0 0

0 0 + +

0 0 + +

Not Possible



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source