問題一覧 > 通常問題

No.2481 Shiritori

レベル : / AI推定難易度 : 1800 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 106
作問者 : shiomusubi496 / テスター : ytqm3
お気に入りにしたユーザー ProblemId : 10177 / 自分の提出
問題文最終更新日: 2023-09-28 19:39:04
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 405 技術室奥プログラミングコンテスト#7 Day1 (順位表) の他の問題:

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.

  1. Kame-kun says one word of $M$ characters.
  2. 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.
  3. 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.

  1. Kame-kun says aa.
  2. Shiomusubi-kun says ab.
  3. Kame-kun says ba.
  4. 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もしくは右上の雲マークをクリックしてアカウントを作成してください。