結果

問題 No.726 Tree Game
ユーザー tktk_snsntktk_snsn
提出日時 2021-01-01 15:44:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 599 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 82,424 KB
実行使用メモリ 61,828 KB
最終ジャッジ日時 2024-04-19 12:16:36
合計ジャッジ時間 2,125 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
55,768 KB
testcase_01 AC 39 ms
56,272 KB
testcase_02 AC 37 ms
56,332 KB
testcase_03 AC 38 ms
56,628 KB
testcase_04 AC 38 ms
56,252 KB
testcase_05 AC 38 ms
56,616 KB
testcase_06 AC 38 ms
56,180 KB
testcase_07 WA -
testcase_08 AC 37 ms
56,012 KB
testcase_09 WA -
testcase_10 AC 36 ms
55,372 KB
testcase_11 AC 39 ms
55,380 KB
testcase_12 AC 37 ms
55,064 KB
testcase_13 AC 38 ms
55,752 KB
testcase_14 AC 38 ms
55,448 KB
testcase_15 AC 41 ms
56,020 KB
testcase_16 AC 40 ms
60,632 KB
testcase_17 AC 42 ms
61,624 KB
testcase_18 AC 41 ms
61,164 KB
testcase_19 AC 39 ms
60,564 KB
testcase_20 AC 39 ms
60,996 KB
testcase_21 AC 42 ms
61,772 KB
testcase_22 AC 42 ms
60,428 KB
testcase_23 AC 41 ms
61,828 KB
testcase_24 AC 42 ms
61,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import lru_cache


@lru_cache(maxsize=None)
def isPrime(n):
    if n == 0 or n == 1:
        return False
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    for i in range(3, int(n ** 0.5) + 1, 2):
        if n % i == 0:
            return False
    return True


def find_prime(x):
    x += 1
    for _ in range(5 * 10 ** 6):
        if isPrime(x):
            return x
        x += 1
    return -1


X, Y = map(int, input().split())
dx = find_prime(X) - X - 1
dy = find_prime(Y) - Y - 1
if (dx + dy) % 2 == 0:
    print("Second")
else:
    print("First")
0