Dating with the girl
Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other)
Total Submission(s) : 175 Accepted Submission(s) : 110
Font: Times New Roman | Verdana | Georgia
Font Size: ← →
Problem Description
Bob and John were best friends. One day they met a pretty girl, both of them desired to date
with the girl. They knew that none of them would succeed if both of them do that. Therefore, they
decided to play a game on the chessboard, and who won the game could date with the girl!
Bob brings a chessboard design for N*N grid, they will put the "knights" on a grid by turns.
The one who cannot put a new knight on any grid will lose the game. And you should know that
every knight has a threat extent, a knight located in square (a, b) can threat squares (a, b), (a-1,
b-2), (a-2, b-1), (a-2, b+1), (a-1, b+2), (a+1, b+2), (a+2, b+1), (a+2, b-1), (a+1, b-2). Anyone
cannot put a knight in the threat extent of the knights that had already on the chessboard. For the
sake of fairness, John can choose to put a knight first or later.
Suppose that Bob and John are intelligent enough, how does John choose to ensure his
succeed?
with the girl. They knew that none of them would succeed if both of them do that. Therefore, they
decided to play a game on the chessboard, and who won the game could date with the girl!
Bob brings a chessboard design for N*N grid, they will put the "knights" on a grid by turns.
The one who cannot put a new knight on any grid will lose the game. And you should know that
every knight has a threat extent, a knight located in square (a, b) can threat squares (a, b), (a-1,
b-2), (a-2, b-1), (a-2, b+1), (a-1, b+2), (a+1, b+2), (a+2, b+1), (a+2, b-1), (a+1, b-2). Anyone
cannot put a knight in the threat extent of the knights that had already on the chessboard. For the
sake of fairness, John can choose to put a knight first or later.
Suppose that Bob and John are intelligent enough, how does John choose to ensure his
succeed?
Input
Input contains multiple test cases. Each test case contain a integer N (1<=N<=100), the sizes
of the chessboards. Input will be ended by the end of file.
of the chessboards. Input will be ended by the end of file.
Output
In each case, you should print on a single line "On the offensive!" if John should play first,
otherwise, print on a single line "On the defensive!".
otherwise, print on a single line "On the defensive!".
Sample Input
1 4
Sample Output
On the offensive! On the defensive!
Author
Source
2012年华南师范大学校赛初赛