C. Sumă vecini

Avem o matrice A de dimensiuni 4x4 cu toate elementele cifre nenule. Cu ajutorul elementelor matricei A se contruiește matricea B. Fiecare element b[i][j] se calculează ca sumă de vecini existenți în cele patru direcții Nord, Est, Sud și Vest, corespunzătoare elementului din matricea A, de pe aceeași poziție a[i][j], adică b[i][j]= a[i-1][j]+ a[i][j+1]+ a[i+1][j]+ a[i][j-1]. În cazul în care poziția indicată de indicii elementului se găsește în afara matricei, valoarea acestuia se va considera egală cu 0.

Se dă următoarea matrice B cu 4 linii și 4 coloane:      

  9 

 11 

 13 

  11

15

19

21

14

14

22

20

23

12

14

20

10

Se cere un exemplu de matrice A (cu toate elementele cifre nenule) din care s-a obținut matricea B.

Bonus (5 puncte): Câte matrice A distincte există, din care se obține matricea B de mai sus?

Sursă: problemă originală (Zoltan Szabo)

 

C. Sum of neighbors

We have a 4x4 matrix A with all non-zero digit elements. Using the elements of the matrix A, construct the matrix B. Each element b[i][j] is calculated as the sum of the existing neighbors in the four directions North, East, South and West, corresponding to the element in the matrix A, from the same position a[i][j], i.e. b[i][j] = a[i-1][j] + a[i][j + 1] + a[i + 1][j] + a[i][j-1]. If the position indicated by the indices of the element is outside the matrix, its value will be considered equal to 0.

Let B be the following matrix with 4 lines and 4 columns:       

  9 

 11 

 13 

 11 

15

19

21

14

14

22

20

23

12

14

20

10

Give an example of a matrix A (with all non-zero digits elements) from which matrix B was obtained.

Bonus (5 points): How many distinct matrices A exist, so that matrix B can be obtained from, as explained above?

Source: original puzzle (Zoltan Szabo)

Vezi comentarii
Logheaza-te in site pentru a trimite solutii si comentarii
trofin

Prima parte a problemei a fost supusă rezolvării la 02.07.2020 cu numele ÎN DEȘERT . Se retrasmite soluția ?  


ruxandra

Multumesc pentru observatie, paragraful indicat nu face parte din problema - asa cum ati observat corect, ramasese din problema din setul trecut.

Am eliminat textul care nu trebuia sa apara. Multumesc!