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

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 01:00
Petrică, tânăr licean în clasa a ix-a, a primit în dar de la părinţii săi un cont bancar pentru micile sale cheltuieli curente. el este pasionat de internet banking şi îşi verifică cu grijă toate tranzacţiile efectuate. pentru creşterea securităţii tranzacţiilor online, banca îi furnizează lui petrică un număr pe care el va trebui să îl modifice, obţinând un număr tan – număr de autentificare a tranzacţiei (transaction authentication number). regula de obţinere a numărului tan este următoarea: se formează cel mai mic număr par din toate cifrele numărului furnizat de bancă. cerinţă cunoscând numărul n furnizat de bancă, să se determine numărul tan obţinut de petrică. date de intrare fişierul tan.in conţine pe prima linie numărul natural n cu semnificaţia din enunţ. date de ieşire fişierul de ieşire tan.out va conţine o singură linie pe care va fi scris numărul tan cerut. restricţii • 0 < n < 18*1018 • n are cel puţin o cifră pară • numărul tan obţinut nu poate conţine zerouri nesemnificative
Answers: 2
question
Computers and Technology, 23.06.2019 16:30
Monica and her team have implemented is successfully in an organization. what factor leads to successful is implementation? good between different departments in an organization leads to successful is implementation.
Answers: 1
question
Computers and Technology, 23.06.2019 22:30
The output voltage of a power supply is assumed to be normally distributed. sixteen observations are taken at random on voltage are as follows: 10.35, 9.30, 10.00, 9.96, 11.65, 12.00, 11.25, 9.58, 11.54, 9.95, 10.28, 8.37, 10.44, 9.25, 9.38, and 10.85
Answers: 1
question
Computers and Technology, 24.06.2019 03:00
Will do anything for brainlest so can you guys me out i will try my best to you out
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
question
Mathematics, 17.11.2020 19:40
question
French, 17.11.2020 19:40
question
Mathematics, 17.11.2020 19:40
question
English, 17.11.2020 19:40
question
English, 17.11.2020 19:40
question
English, 17.11.2020 19:40
question
Arts, 17.11.2020 19:40
Questions on the website: 13722363