結果

問題 No.726 Tree Game
ユーザー 👑 KazunKazun
提出日時 2021-02-25 03:31:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 811 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 81,728 KB
実行使用メモリ 59,384 KB
最終ジャッジ日時 2023-10-25 08:30:47
合計ジャッジ時間 2,748 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,444 KB
testcase_01 AC 36 ms
53,444 KB
testcase_02 AC 37 ms
53,444 KB
testcase_03 AC 37 ms
53,444 KB
testcase_04 AC 37 ms
53,444 KB
testcase_05 AC 38 ms
53,444 KB
testcase_06 AC 37 ms
53,444 KB
testcase_07 WA -
testcase_08 AC 38 ms
53,444 KB
testcase_09 WA -
testcase_10 AC 37 ms
53,444 KB
testcase_11 AC 37 ms
53,444 KB
testcase_12 AC 36 ms
53,444 KB
testcase_13 AC 38 ms
53,444 KB
testcase_14 AC 36 ms
53,444 KB
testcase_15 AC 38 ms
53,444 KB
testcase_16 AC 40 ms
59,384 KB
testcase_17 AC 41 ms
59,384 KB
testcase_18 AC 42 ms
59,384 KB
testcase_19 AC 41 ms
59,384 KB
testcase_20 AC 42 ms
59,384 KB
testcase_21 AC 41 ms
59,384 KB
testcase_22 AC 41 ms
59,384 KB
testcase_23 AC 41 ms
59,380 KB
testcase_24 AC 41 ms
59,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def Is_Prime(N):
    N=abs(N)
    if N<=1:
        return False

    if N in {2,3,5}:
        return True

    r=N%6
    if not(r==1 or r==5):
        return False

    k=5
    Flag=1
    while k*k<=N:
        if N%k==0:
            return False

        k+=2 if Flag else 4
        Flag^=1
    return True

def Next_Prime(N,K=1):
    """
    Nを上回る自然数のうち,K番目に小さい素数

    N:自然数
    """
    if K>0:
        while K>0:
            N+=1
            if Is_Prime(N):
                K-=1
    else:
        while K<0:
            N-=1
            if Is_Prime(N):
                K+=1
    return N
#================================================
Y,X=map(int,input().split())
alpha=Next_Prime(Y)-1
beta =Next_Prime(X)-1
T=(alpha+beta)-(X+Y)

print("First" if T%2 else "Second")
0