-->
当前位置:首页 > 题库 > 正文内容

PROGRAMMING:Little Gyro and Derrick

Luz3年前 (2021-05-10)题库297
Little Gyro and Derrick are playing a wonderful game called *Escape the Board* on an $$N$$ ×$$ M$$ board.
Initially, there are $$K$$ pieces belong to Little Gyro on the board, and Derrick has 2 ×($$ N$$ + $$M$$) baffles.
In Little Gyro's turn, Little Gyro can move his pieces to the neighbouring (by side) cells. If the pieces lies at the border of the board then Little Gyro can move it outside the board and win the game.
Every time after Little Gyro's move, Derrick bans one edge with his baffle   as shown in the figure below. Little Gyro can't move his pieces through the baffle. If Little Gyro can't move any piece outside the board, then Derrick wins.

Given the size of the $$N$$ ×$$ M$$ board, and the initial coordinates of Little Gyro's $$K$$ pieces, please judge whether Little Gyro will win the game or not.
### Input Specification:
There are multiple test cases. The first line of the input contains an integer $$T$$, indicating the number of test cases. For each test case:
The first line contains three integers $$N$$, $$M$$ (1 ≤ $$N$$, $$M$$ ≤ 100) indicating the dimensions of the board and $$K$$ (0 ≤ $$K$$ ≤ 100) indicating the number of pieces.
In the following $$K$$ lines, each line contains two integers $$x$$, $$y$$ (1 ≤ $$x$$ ≤ $$N$$, 1 ≤ $$y$$ ≤ $$M$$), separated by space, indicating the coordinates of the corresponding pieces.
There could be more than one piece at a cell.
### Output Specification:
For each test case, if Little Gyro wins the game, print "Happy Little Gyro" (without quotes), otherwise, print "Sad Little Gyro" (without quotes) instead.
### Sample Input:
```in
two
2 2 1
1 2
3 4 0
```
### Sample Output:
```out
Happy Little Gyro
Sad Little Gyro
```







answer:If there is no answer, please comment

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。