Problem description A decade ago, China introduced a number of films from abroad every year, including a movie called "The Game of the Brave" (English Name: Zathura), and until now I was still impressed by some of the computer stunts in the movie.
Today, everyone chooses to take the machine test, is a kind of brave (brave) choice; This short semester, we are talking about game (games) topic, so, everyone is playing "brave game", which is why I named this topic.
Of course, in addition to "brave", I also hope to see "good faith", no matter how the test results, want to see is a real result, I also believe that we can certainly do it ~
What is the first game the brave people want to play? Quite simply, it is defined as:
1, the game is a two-person game;
2, there are a lot of stones have n;
3, the two people take turns;
4, each step can take away 1...m of stones;
5, the first to take the light of the side of the stone to win;
If both sides of the game are using the optimal strategy, please output which one will win.
Input data first contains a positive integer c (c<=100), which indicates that there is a C set of test data.
Each set of test data contains a row of two integers n and m (1<=n,m<=1000), and the meanings of N and M are described in the topic.
Output if the first person can win, please export "second", otherwise output "", the output of each instance occupies one row.
Sample Input223 24 3
Sample Outputfirstsecond
#include <iostream>using namespacestd;intMain () {intn,m; intT; CIN>>T; while(t--) {cin>>n>>m; if(n<=m) {cout<<" First"<<Endl; } Else if(n% (m+1)==0) {cout<<"Second"<<Endl; } Elsecout<<" First"<<Endl; } return 0;}
Simple game of Hdu 1846 Brave game