結果

問題 No.726 Tree Game
ユーザー mjkttenhoubot
提出日時 2018-08-24 23:32:11
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 653 bytes
コンパイル時間 425 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-06-23 10:25:02
合計ジャッジ時間 1,597 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

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 x==2 or y==2:
    print('Second')
    exit()
if x==1:
    x = 4
if y==1:
    y = 4


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

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