No.2481 Shiritori
タグ : / 解いたユーザー数 106
作問者 :
shiomusubi496
/ テスター :
Problem Statement
The language of the Paken Kingdom uses $N$ kinds of characters. This language is a special one: any combination of these characters has a meaning as a word.
Kame-kun and Shiomusubi-kun decided to play shiritori in this language, with Kame-kun moving first. Since plain shiritori would be boring, they will use only words of $M$ characters.
More precisely, the game proceeds as follows.
- Kame-kun says one word of $M$ characters.
-
The following is repeated in turns, starting with Shiomusubi-kun.
- Say one word of $M$ characters that begins with the last character of the word the opponent just said and that neither of the two has said so far.
- The player who can no longer say a word satisfying the condition loses.
When both players act optimally, who wins?
Input
$N$ $M$
- $1 \leq N, M \leq 10^{18}$
- All inputs are integers.
Output
Print First if Kame-kun wins, or Second if Shiomusubi-kun wins, on one line, followed by a newline.
Sample
Sample 1
Input
2 2
Output
First
Let us call the $2$ kinds of characters a and b. Then the words of $2$ characters are aa, ab, ba, bb.
In this case, the game may proceed as follows, for example.
- Kame-kun says
aa. - Shiomusubi-kun says
ab. - Kame-kun says
ba. - Shiomusubi-kun has no word left to say and loses.
Sample 2
Input
1 1000000000000000000
Output
First
Sample 3
Input
314159265358 979323846264
Output
Second
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。