목차

Singularity of the Nim

ps
링크acmicpc.net/…
출처BOJ
문제 번호27871
문제명Singularity of the Nim
레벨플래티넘 1
분류

게임 이론

시간복잡도O(T)
인풋사이즈T<=?
사용한 언어Python 3.11
제출기록60548KB / 488ms
최고기록460ms
해결날짜2023/06/16

풀이

코드

"""Solution code for "BOJ 27871. Singularity of the Nim".

- Problem link: https://www.acmicpc.net/problem/27871
- Solution link: http://www.teferi.net/ps/problems/boj/27871

Tags: [game theory]
"""

import sys


def main():
    T = int(sys.stdin.readline())
    for _ in range(T):
        # pylint: disable=unused-variable
        N, P = [int(x) for x in sys.stdin.readline().split()]
        C = [int(x) for x in sys.stdin.readline().split()]

        print('First' if C[0] % (P + 1) != 0 else 'Second')


if __name__ == '__main__':
    main()