Click Open link
Brave Game
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission (s): 6903 Accepted Submission (s): 4636
Problem Description when I was a university student ten years ago, China introduced some film blockbusters from abroad every year. One of the movies was called "the player's game" (English name: Zathura ), until now, I have been impressed by some of the computer stunts in the movie.
Today, we chose the computer test as a brave choice. In this short term, we are talking about the game topic. Therefore, now everyone is playing the "multiplayer game", which is why I name this question.
Of course, in addition to being brave, I also hope to see "integrity". No matter what the test scores are, what I want to see is a real result. I believe everyone can do it ~
What is the first game to be played by beginners? It is very simple. It is defined as follows:
1. This game is a two-person game;
2. There are a pile of stones with n in total;
3. Take turns;
4. Each step can take 1... M stones;
5. The first party to win the light stones;
If both sides of the game are using the best strategy, please output which one can win.
The Input data first contains a positive integer C (C <= 100), indicating that there are group C test data.
Each group of test data occupies one row and contains two integers n and m (1 <= n, m <= 1000). For the meanings of n and m, see the topic description.
Output: If the first person wins, Output "first"; otherwise, Output "second". The Output of each instance occupies one row.
Sample Input
223 24 3
Sample Output
Firstsecond
A very naked Bashi game
Code:
# Include <cstdio> # include <cstring> int main () {int t, n, m; scanf ("% d", & t); while (t --) {scanf ("% d", & n, & m); if (n % (m + 1) printf ("first \ n "); else printf ("second \ n");} return 0 ;}
Game of hdu 1846 Brave Game