Wizards and Numbers

题意翻译

# 题目描述: 双方进行游戏,有两个正整数a,b 若a<=b 双方轮流进行选择下列两种操作之一 1)将b对a取模,即b变为b%a 2)从b中减去a的幂,不能减成负数,即b变为b-a^k(b-a^k>=0且k为正整数) 若a>b,类似 若a,b中之一为0,则无法进行,无法进行者败 输入初始a,b,判断先后手谁有必胜策略 ## 输入 第一行一个正整数T 接下来T行每行两个正整数a,b ## 输出 对于每个数据输出"First"或"Second"表示先手必胜或后手必胜 ## 样例输入 4 10 21 31 10 0 1 10 30 ## 样例输出 First Second Second First ## 样例解释 在样例一中,第一个玩家只能变换到(11,10)。然后在第二个玩家变换到(1,10)后,第一个玩家可以将10对1取余就赢了。 在样例二中,第一个玩家可以变换到(1,10)或(21,10),不管哪种,第二个玩家都赢。 在样例三中,第一个玩家无法操作。 在样例四中,第一个玩家直接对30进行取余,就赢了。 ## 数据范围 对于30%的数据,a,b<=1000 对于100%的数据,a,b<=10^18,T<=10^3

题目描述

In some country live wizards. They love playing with numbers. The blackboard has two numbers written on it — $ a $ and $ b $ . The order of the numbers is not important. Let's consider $ a<=b $ for the sake of definiteness. The players can cast one of the two spells in turns: - Replace $ b $ with $ b-a^{k} $ . Number $ k $ can be chosen by the player, considering the limitations that $ k&gt;0 $ and $ b-a^{k}>=0 $ . Number $ k $ is chosen independently each time an active player casts a spell. - Replace $ b $ with $ b mod a $ . If $ a&gt;b $ , similar moves are possible. If at least one of the numbers equals zero, a player can't make a move, because taking a remainder modulo zero is considered somewhat uncivilized, and it is far too boring to subtract a zero. The player who cannot make a move, loses. To perform well in the magic totalizator, you need to learn to quickly determine which player wins, if both wizards play optimally: the one that moves first or the one that moves second.

输入输出格式

输入格式


The first line contains a single integer $ t $ — the number of input data sets ( $ 1<=t<=10^{4} $ ). Each of the next $ t $ lines contains two integers $ a $ , $ b $ ( $ 0<=a,b<=10^{18} $ ). The numbers are separated by a space. Please do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specificator.

输出格式


For any of the $ t $ input sets print "First" (without the quotes) if the player who moves first wins. Print "Second" (without the quotes) if the player who moves second wins. Print the answers to different data sets on different lines in the order in which they are given in the input.

输入输出样例

输入样例 #1

4
10 21
31 10
0 1
10 30

输出样例 #1

First
Second
Second
First

说明

In the first sample, the first player should go to (11,10). Then, after a single move of the second player to (1,10), he will take 10 modulo 1 and win. In the second sample the first player has two moves to (1,10) and (21,10). After both moves the second player can win. In the third sample, the first player has no moves. In the fourth sample, the first player wins in one move, taking 30 modulo 10.