Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Question by Ibrahim Mesecan.
Multiply a row and add it to another
In gaussian elimination, the rows are multiplied
with a constant and added over another.
The following adds s times Rowi to Rowj
sRi + Rj --> Rj
Question:
Write a program reads a 2D array and three integers
(i, j and s). And calculates and prints the new array.
Input specification:
First, you will be two integers: the number of rows
(n) and the number of columns (m). Each of the
following n lines will contain m integer. Then,
you will be given 3 integers:(i, j and s) where
m, n, i and j are between 2 and 100, s is between
1 and 100 the numbers in 2D array are between
-1000 and +1000.
Output specification:
Show the new 2D array.
Sample Input I |
Sample Input II |
4 3
4 7 1
2 3 10
1 10 5
1 5 6
3 2 -2
|
3 4
-5 10 10 9
-10 -1 -7 2
2 -6 -3 -2
3 1 2
|
Sample Output I |
Sample Output II |
4 7 1
0 -17 0
1 10 5
1 5 6
|
-1 -2 4 5
-10 -1 -7 2
2 -6 -3 -2
|
Explanation:
In sample input I, there is 1 in the first array,
but it does not exist in the second array. All
the numbers in two arrays appears at least
one in two arrays in the second sample.
Для отправки решений необходимо выполнить вход.
|