Problem C - Revenge of Faucet Flow
![]() |
Наши проекты:
Журнал · Discuz!ML · Wiki · DRKB · Помощь проекту |
|
| ПРАВИЛА | FAQ | Помощь | Поиск | Участники | Календарь | Избранное | RSS |
| [3.41.188.32] |
|
|
правила раздела Алгоритмы

Problem C - Revenge of Faucet Flow
|
Сообщ.
#1
,
|
|
|
|
Здравствуйте.
Есть задание: http://acm.uva.es/p/v106/10675.html A faucet is pouring water into an MxN rectangular aquarium. The aquarium's floor is uneven, formed from a number of unit cubes piled on top of one another (and glued, to make them watertight). Thus, every square in the aquarium has a specific height, from 0 to 9. There are no other walls or obstructions in or surrounding the aquarium (it is open on all sides). Water pours from the faucet at a rate of 1 cubic unit per second. How long will it take before water begins spilling over one of the sides? You may assume that the water behaves ideally: it instantly spreads out across any flat surface, spilling over all adjacent edges at an equal rate of flow. It cannot flow between two cubes that touch, even at a corner. Input There are up to 20 test cases. Each test case begins with a line containing two integers M and N (1 <= M,N <= 10), specifying the number of rows and columns in the aquarium, respectively. The next line contains R and C (1 <= R <= M, 1 <= C <= N), giving the coordinates of the square the faucet is pouring on. (1,1) is the upper-left corner. Finally, M lines with N integers are given, specifying the height of each square in the aquarium. Input is terminated with a line containing two zeros. For each case, output one line containing the number of seconds it will take before water starts spilling over any of the four sides of the aquarium. Print your answer accurate to two decimal places. Sample Input 4 4 2 2 5 3 5 5 5 0 2 5 5 2 2 5 5 5 5 5 0 0 Output 6.00 Кто-нибудь может подсказать алгоритм решения этого задания. В итоге - нужно сделать все это на с++. Буду рад, если кто-то сможет посоветовать что и как и где. Вариантов решения данной проблемы в инете я не нашел А жаль.Спасибо. // nikita |
|
Сообщ.
#2
,
|
|
|
|
С такими вопросами - сюда (там есть один чудак - всё решает и выкладывает решения в отдельную ветку форума)
Алгофорум Правда, он пишет на паскале |