subject

Egy téglalap alakú rácsháló minden pontjáról ismerjük, hogy ott tenger van-e (0 érték) vagy valamely sziget (1 és K közötti érték, ahol K sziget van). Két pont távolsága az indexeik különbségének abszolút értékének összege (Manhattan távolság, pl. (3,2) és (5,1) távolsága abs(3-5)+abs(2-1)=3).
Írj programot, amely megadja a két legközelebbi szigetet!
Bemenet
A standard bemenet első sorában a rácsháló sorai és oszlopai száma (1≤N, M≤100), valamint a szigetek száma (2≤K≤100) van. A következő N sor mindegyikében M szám szerepel a
rácsháló pontjai (0≤Ri, j≤K).
Kimenet
A standard kimenet első sorába két legközelebbi sziget sorszámát kell írni! Több megoldás
esetén közülük tetszőleges írható.
Példa
Bemenet Kimenet
6 5 3
0 1 1 0 0
0 1 1 0 0
0 0 0 0 2
0 0 0 0 2
0 0 0 3 0
3 3 3 3 0
2 3

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 07:00, ayoismeisalex
Our primary purpouse as electricians is to do wich of the following core concepts? a: install electrical components in a way they can be upgraded b: install electrical equiptment in a way that reduces heat c: install electrical systems in a safe manner d: only b and c
Answers: 1
image
Computers and Technology, 22.06.2019 17:30, kameronstebbins
Which tab should you open to find the option for adding a header?
Answers: 1
image
Computers and Technology, 22.06.2019 23:30, Nason156
What are some ways to use a range name in a formula? check all that apply. in the defined names group, click use in formula, and then select the desired name. begin typing the name in the formula, select a name from the autocomplete list, and use the arrow keys and tab key to enter the name in the formula. begin typing the formula, and then click and drag with the mouse to select the cells to include in the formula. right-click one of the cells in the range. click formula options, and use the dialog box to add the name.
Answers: 1
image
Computers and Technology, 23.06.2019 06:40, euniceyi56
How many nibbles can be stored in a 16-bit word?
Answers: 1
You know the right answer?
Egy téglalap alakú rácsháló minden pontjáról ismerjük, hogy ott tenger van-e (0 érték) vagy valamely...

Questions in other subjects:

Konu
Mathematics, 22.07.2019 13:00