結果
| 問題 |
No.726 Tree Game
|
| コンテスト | |
| ユーザー |
simamumu
|
| 提出日時 | 2018-08-24 22:24:28 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,101 bytes |
| コンパイル時間 | 99 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 11,776 KB |
| 最終ジャッジ日時 | 2024-06-23 07:56:16 |
| 合計ジャッジ時間 | 2,000 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 20 |
ソースコード
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')
simamumu