結果
| 問題 |
No.726 Tree Game
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-29 12:25:13 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,053 bytes |
| コンパイル時間 | 433 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-11-28 01:15:56 |
| 合計ジャッジ時間 | 2,151 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 WA * 1 |
ソースコード
MOD = 10 **9 + 7
INF = 10 ** 10
def is_prime(n):
if n == 1:
return False
for i in range(2,n):
if i * i > n:
break
if n%i == 0:
return False
return True
def main():
y,x = map(int,input().split())
if is_prime(x) and is_prime(y):
print('Second')
return
if is_prime(x):
x += 1
h,w = 0,1
while not is_prime(y):
h += 1
y += 1
while not is_prime(x):
w += 1
x += 1
elif is_prime(y):
y += 1
h,w = 1,0
while not is_prime(y):
h += 1
y += 1
while not is_prime(x):
w += 1
x += 1
else:
x += 1
y += 1
h,w = 0,0
while not is_prime(y):
h += 1
y += 1
while not is_prime(x):
w += 1
x += 1
if (h + w)%2 == 0:
print('Second')
else:
print('First')
if __name__ == '__main__':
main()