传教士与野人问题:
有三个牧师和三个野人过河,只有一条能装下两个人的船,在河的任何一方或者船上,如果野人的人数大于牧师的人数,那么牧师就会有危险。
你能不能找出一种安全的渡河方法呢?这个问题还可以扩展为N1个牧师和N2个野人,而船一次可以装下M个人的情况。
有三个牧师和三个野人过河,只有一条能装下两个人的船,在河的任何一方或者船上,如果野人的人数大于牧师的人数,那么牧师就会有危险。
你能不能找出一种安全的渡河方法呢?这个问题还可以扩展为N1个牧师和N2个野人,而船一次可以装下M个人的情况。