description

Given a 5 * 5 matrix (mathematically, a matrix of r × c is a rectangular array of elements in columns r and c), swap the nth and mth rows, and output the exchanged results.

There are 6 lines of input. The first 5 lines of the matrix are separated by a space between each element.

Line 6 contains two integers m, n, separated by a space. (1 <= m, n <= 5) Output the matrix after the exchange. Each row of the matrix occupies one row, and the elements are separated by a space. Sample input:

1 2 2 1 2

5 6 7 8 3

9 3 0 5 3

7 2 1 4 6

3 0 8 2 4

1 5

Sample output:

3 0 8 2 4

5 6 7 8 3

9 3 0 5 3

7 2 1 4 6

1 2 2 1 2

Examples

#include

using namespace std;

int main ()

{

int a [5] [5], m, n, i, j;

for (i = 0; i <5; i ++)

for (j = 0; j > a [i] [j];

cin >> m >> n;

for (j = 0; j <5; j ++) {

i = a [m-1] [j];

a [m-1] [j] = a [n-1] [j];

a [n-1] [j] = i;

}

for (i = 0; i <5; i ++) {

for (j = 0; j <5; j ++) {

cout << a [i] [j] << "";

}

cout << endl;

}

return 0;

}