Problem D. 73511. Quarters Input file: Out put file: Time limit: Memory limit: standard input standard output 1 second 256 megabytes In this task, you have to generate a two-dimensional array of n...


Problem D. 73511. Quarters<br>Input file:<br>Out put file:<br>Time limit:<br>Memory limit:<br>standard input<br>standard output<br>1 second<br>256 megabytes<br>In this task, you have to generate a two-dimensional array of n rows and m columns in the following way.<br>Let's pass two lines through our two-dimensional array horizontally and vertically, both cutting the array<br>in the middle. Formally, these are the horizontal line after -th row and the vertical line after -th column<br>(n and m are even).<br>Now we have four parts of the array: right-upper quarter, left-upper quarter, left-lower quarter and right-<br>lower quarter. Fill the right-upper quarter with 0-s, the left-upper quarter with 1-s, the left-lower quarter<br>with 2-s, the right-lower quarter with 3-s. For clearance, see the examples below.<br>Input<br>The first line of input contains two-separated positive even integers n and m – the number of rows and<br>columns respectively (2 < n, m < 100).<br>Output<br>Output n lines each containing m space-separated integers – the generated array with each cell having<br>the number of corresponding quarter.<br>Examples<br>standard input<br>standard output<br>0 00<br>4 6<br>11<br>11 1000<br>222333<br>222333<br>26<br>111000<br>222333<br>88<br>11 1 1000o<br>111 1000o<br>1111000 o<br>111100<br>22223<br>222233<br>22223<br>22223333<br>42<br>10<br>10<br>23<br>23<br>

Extracted text: Problem D. 73511. Quarters Input file: Out put file: Time limit: Memory limit: standard input standard output 1 second 256 megabytes In this task, you have to generate a two-dimensional array of n rows and m columns in the following way. Let's pass two lines through our two-dimensional array horizontally and vertically, both cutting the array in the middle. Formally, these are the horizontal line after -th row and the vertical line after -th column (n and m are even). Now we have four parts of the array: right-upper quarter, left-upper quarter, left-lower quarter and right- lower quarter. Fill the right-upper quarter with 0-s, the left-upper quarter with 1-s, the left-lower quarter with 2-s, the right-lower quarter with 3-s. For clearance, see the examples below. Input The first line of input contains two-separated positive even integers n and m – the number of rows and columns respectively (2 < n,="" m="">< 100).="" output="" output="" n="" lines="" each="" containing="" m="" space-separated="" integers="" –="" the="" generated="" array="" with="" each="" cell="" having="" the="" number="" of="" corresponding="" quarter.="" examples="" standard="" input="" standard="" output="" 0="" 00="" 4="" 6="" 11="" 11="" 1000="" 222333="" 222333="" 26="" 111000="" 222333="" 88="" 11="" 1="" 1000o="" 111="" 1000o="" 1111000="" o="" 111100="" 22223="" 222233="" 22223="" 22223333="" 42="" 10="" 10="" 23="">

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here