結果

問題 No.726 Tree Game
ユーザー mjkttenhoubot
提出日時 2018-08-24 22:52:23
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 661 bytes
コンパイル時間 121 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-23 08:39:12
合計ジャッジ時間 1,633 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 3 RE * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

def isPrime(num):
    if num==1:
        return False
    if num==2:
        return True
    if num%2==0:
        return False
    for i in range(3,int(num**.5)+1,2):
        if num%i==0:
            return False
    return True

x,y = map(int,input().split())

if isPrime(x) and isPrime(y):
    print('Second')
    exit()
if x==2 or y==2:
    print('Second')
    exit()

for x_next in range(x+1,10**9):
    if x_next%2==0:
        continue
    if isPrime(x_next):
        break
for y_next in range(y+1,10**9):
    if y_next%2==0:
        continue
    if isPrime(y_next):
        break

if (x_next+y_next-x-y)%2==1:
    print('First')
else:
    print('Second')
0