結果

問題 No.726 Tree Game
ユーザー simamumusimamumu
提出日時 2018-08-24 22:24:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,101 bytes
コンパイル時間 71 ms
コンパイル使用メモリ 11,148 KB
実行使用メモリ 10,604 KB
最終ジャッジ日時 2023-09-05 12:18:10
合計ジャッジ時間 2,113 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 33 ms
10,448 KB
testcase_03 AC 32 ms
10,516 KB
testcase_04 AC 33 ms
10,368 KB
testcase_05 AC 32 ms
10,388 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 32 ms
10,504 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

X,Y = inpl()
MAX = 10**1333

if X >= 10 or Y >= 10:
	print(0)

def is_prime(x):
    if x < 2: return False # 2未満に素数はない
    if x == 2 or x == 3 or x == 5: return True # 2,3,5は素数
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0: return False # 2,3,5の倍数は合成数

    # ためし割り: 疑似素数(2でも3でも5でも割り切れない数字)で次々に割っていく
    prime = 7
    step = 4
    while prime <= math.sqrt(x):
        if x % prime == 0: return False

        prime += step
        step = 6 - step

    return True

dist_x = 0
X += 1
while True:
	if is_prime(X) or X >= MAX:
		break
	else:
		dist_x += 1
		X += 1

dist_y = 0
Y += 1
while True:
	if is_prime(Y) or Y >= MAX:
		break
	else:
		dist_y += 1
		Y += 1

if (dist_x + dist_y)%2 == 0:
	print('Second')
else:
	print('First')
0