This algorithm uses python3 To write , We also need to follow the doctrine N,L and M Value range of , Make sure you can get out in different situations . This is a sample question from the previous Australian programming competition , I hope you can pool your ideas , thank you