编程介的小学生 2017-02-27 11:45 采纳率: 20.5%
浏览 982
已采纳

Chocobo World

Biko is a baby chocobo. One day, his friend Mog (a cat) disappreared while looking for treasure. Thus Biko started searching for Mog with Catanus (a cactus) and Moomba (a monkey-like animal). Though they were partners, Catanus and Moomba were only responsible for finding weapons and items every now and then, Biko had to adventure on his own.

Chocobo World is a SOLO-RPG��which means that the game can run automatically without being controled by players. Biko can walk, fight and sleep all by himself.

The game is played on a map of N*N grids which is shown by the above image in the middle. The point which blinks is where Biko is. The other points represent places of events. An event can be a battle, an item, a weapon or plot. Events that are touched off no longer exist. The game system employs the following method to make the game advance on it's own. The player first assign a value m to MOVE in the menu. Then every time Biko enters a grid, he first checks m grids ahead, to the left and to the right of himself. If there's no events in these grids, he will keep his direction. Or if there's any event(s) going on, Biko will turn to the direction where the nearest one is. If there are more than one possible choices, he will select by the priority order moving ahead > turning left > turning right. For example, in the map above, if m = 5��Biko's initial direction is to the right. He goes to right 3, up 3, right 1, down 2, etc.

Now given N,m,and places of l events, output the order that Biko touches them off.

Input

Input contains several tests. Each test has 3 intergers on its first line: N (N <= 100)��m (m >= 0) and l(l <= 1000). The jth of the following l lines contain the x, y coordinates of the jth event. The upper left corner is (1��1), x axis points down and y axis points right. Any two events do no overlap. The following line has 2 integers x0 and y0 (1 <= x0, y0 <= N) represents the initial positon of Biko, where there is always no events. Biko always faces east at the beginning. Input is terminated with N = m = l = 0.

Output

A line for each case,output the events Biko touched off in the order he did. Two adjacent numbers are seperated by a space. No spaces at the end of line.

P.S. The left side and the right side of the map are connected, so are the top border and the bottom border.

Sample Input

18 5 8
1 18
7 12
8 11
8 18
9 12
13 8
14 13
14 14
10 8
0 0 0

Sample Output

3 2 5 6 4 1 8 7

  • 写回答

2条回答 默认 最新

查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退