BNU 26582 Gregory the Grasshopper【简单BFS】

is a . Hisfood areleafs — he cannever haveof them.he spots such a leaf, he wants to eat it asas .is also lazy, so he wants to move to the leaf with. Your task is to help him to find theway to aleaf.
【BNU 26582 Gregory the Grasshopper【简单BFS】】

BNU 26582 Gregory the Grasshopper【简单BFS】

文章插图
For , we willthatlives on agridof unit . As a , heto move by(or, more , ) from oneto the other. Each hop takes him to athat is in therow orin one , and twoor rows away in the other . So, his hopsthe moves of aon a .
BNU 26582 Gregory the Grasshopper【简单BFS】

文章插图