标题:传教士与食人魔的故事 出处:Felix021 时间:Thu, 01 May 2008 02:14:21 +0000 作者:felix021 地址:https://www.felix021.com/blog/read.php?878 内容: 2008年4月27日第二届中南地区程序设计邀请赛(国防科技大学)决赛B题 Problem B - The missionaries and cannibals Desciption The missionaries and cannibals problem is usually stated as follows: Three missionaries and three cannibals are on one side of a river, along with a boat that can hold one or two people. Find a way to get everyone to the other side, without ever leaving a group of missionaries in one places outnumbered by the cannibals in that place. Now the problem has been extended to be more complicated. There are m missionaries and m cannibals who want to cross the river. And the boat is also enlarged to be capable of supporting n people. In order to make all of them cross the river safely, what s the least number of steps? Notice that when the boat goes across the river there must be at least one missionariy o cannibal on the boat. Input The first line of the input is an integer T which indicates the number of test cases. Each test case is specified on a separate line and is made of two positive number m and n, where m Generated by Bo-blog 2.1.0