As a wildfire rages through the grasslands, three lions and three wildebeest flee for their lives. To escape the inferno, they must cross over to the left bank of a crocodile-infested river. Fortunately, there happens to be a raft nearby. It can carry up to two animals at a time, and needs as least one lion or wildebeest on board to row it across the river. There's just one problem. If the lions ever outnumber the wildebeest on either side of the river, even for a moment, their instincts will kick in, and the results won't be pretty. That includes the animals in the boat when it's on a given side of the river. What's the fastest way for all six animals to get across without the lions stopping for dinner? Pause here if you want to figure it out for yourself. Answer in: 3 Answer in: 2 Answer in: 1 If you feel stuck on a problem like this, try listing all the decisions you can make at each point, and the consequences each choice leads to. For instance, there are five options for who goes across first: one wildebeest, one lion, two wildebeest, two lions, or one of each. If one animal goes alone, it'll just have to come straight back. And if two wildebeest cross first, the remaining one will immediately get eaten. So those options are all out. Sending two lions, or one of each animal, can actually both lead to solutions in the same number of moves. For the sake of time, we'll focus on the second one. One of each animal crosses. Now, if the wildebeest stays and the lion returns, there will be three lions on the right bank. Bad news for the two remaining wildebeest. So we need to have the lion stay on the left bank and the wildebeest go back to the right. Now we have the same five options, but with one lion already on the left bank. If two wildebeest go, the one that stays will get eaten, and if one of each animal goes, the wildebeest on the raft will be outnumbered as soon as it reaches the other side. So that's a dead end, which means that at the third crossing, only the two lions can go. One gets dropped off, leaving two lions on the left bank. The third lion takes the raft back to the right bank where the wildebeest are waiting. What now? Well, since we've got two lions waiting on the left bank, the only option is for two wildebeest to cross. Next, there's no sense in two wildebeest going back, since that just reverses the last step. And if two lions go back, they'll outnumber the wildebeest on the right bank. So one lion and one wildebeest take the raft back leaving us with one of each animal on the left bank and two of each on the right. Again, there's no point in sending the lion-wildebeest pair back, so the next trip should be either a pair of lions or a pair of wildebeest. If the lions go, they'd eat the wildebeest on the left, so they stay, and the two wildebeest cross instead. Now we're quite close because the wildebeest are all where they need to be with safety in numbers. All that's left is for that one lion to raft back and bring his fellow lions over one by one. That makes eleven trips total, the smallest number needed to get everyone across safely. The solution that involves sending both lions on the first step works similarly, and also takes eleven crossings. The six animals escape unharmed from the fire just in time and begin their new lives across the river. Of course, now that the danger's passed, it remains to be seen how long their unlikely alliance will last.
Quando um grande incêndio queima os prados, três leões e três gnus fogem para salvar suas vidas. Para escapar do inferno, eles precisam atravessar para a margem esquerda de um rio infestado de crocodilos. Felizmente há uma jangada por perto, mas que pode transportar apenas dois animais por vez, e precisa de pelo menos um leão ou um gnu a bordo para navegar pelo rio. Só há um problema: se a quantidade de leões ultrapassar a de gnus em qualquer dos lados do rio, mesmo que por um momento, o instinto falará mais alto, e a coisa pode não acabar bem. Isso inclui os animais na jangada quando ela estiver em determinado lado do rio. Qual é a forma mais rápida para atravessar os seis animais sem que os leões parem para jantar? [Pare o vídeo se quiser descobrir por si mesmo. Resposta em: 3 Resposta em: 2 Resposta em: 1] Caso fique empacado num problema como este, tente listar todas as decisões que você pode tomar em cada momento, e as consequências que essas escolhas podem causar. Por exemplo, há cinco opções de quem vai primeiro: um gnu, um leão, dois gnus, dois leões, ou um de cada. Se um animal for sozinho, ele terá que voltar. E se dois gnus atravessarem primeiro, o que ficar será imediatamente devorado. Portanto, podemos descartar todas essas opções. Enviar dois leões, ou um animal de cada, pode conduzir ambos a soluções com o mesmo número de movimentos. Mas, por causa do tempo, focaremos o segundo. Um de cada animal atravessa. Agora, se o gnu fica, e o leão retorna, haverá três leões na margem direita. Má notícia para os dois gnus restantes. Precisamos que o leão fique na margem esquerda, e o gnu retorne para a da direita. Agora temos as mesmas cinco opções, mas com um leão já na margem esquerda. Se dois gnus forem juntos, o que ficar será comido, e, se um de cada animal for, o gnu na jangada estará em desvantagem assim que chegar ao outro lado. Isso é um impasse, significando que na terceira travessia somente os dois leões podem ir. Um deles é deixado, deixando dois leões no lado esquerdo. O terceiro leão volta com a jangada para o lado direito onde os gnus estão esperando. E agora? Bom, como temos dois leões esperando na margem esquerda, a única opção é dois gnus atravessarem. A seguir, não faz sentido dois gnus retornarem, visto que só inverteríamos o último passo. E, se dois leões retornassem, estariam em maior número do que o gnu na margem direita. Um leão e um gnu voltarão na jangada, deixando-nos com um de cada animal na margem esquerda e dois de cada na direita. Novamente, não há razão para retornar um leão e um gnu, então a próxima viagem deve ser de um par de leões ou um par de gnus. Se os leões fossem, comeriam o gnu na margem esquerda; então devem ficar, e os dois gnus atravessam em vez disso. Agora estamos bem próximos, pois os gnus estão todos onde deveriam estar, e em maior número. Tudo o que resta ao leão é fazer o caminho de volta e trazer seus companheiros leões um a um. Isso dá um total de 11 viagens, o mínimo necessário para atravessar todos em segurança. A solução envolvendo o envio de dois leões citada inicialmente funciona igual a esta, e também leva a 11 travessias. Os seis animais escaparam do fogo ilesos e a tempo, e começaram suas novas vidas do outro lado do rio. Claro, já que o perigo passou, resta saber quanto tempo esta improvável aliança vai durar.