結果

問題 No.726 Tree Game
ユーザー nebukuro09nebukuro09
提出日時 2018-08-24 21:39:19
言語 PyPy2
(7.3.15)
結果
RE  
実行時間 -
コード長 563 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 77,588 KB
実行使用メモリ 77,092 KB
最終ジャッジ日時 2023-09-05 11:13:46
合計ジャッジ時間 3,178 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 74 ms
76,388 KB
testcase_02 RE -
testcase_03 AC 73 ms
76,468 KB
testcase_04 AC 71 ms
76,356 KB
testcase_05 RE -
testcase_06 AC 71 ms
76,332 KB
testcase_07 AC 71 ms
76,268 KB
testcase_08 AC 71 ms
76,336 KB
testcase_09 WA -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 72 ms
76,356 KB
testcase_14 AC 70 ms
76,044 KB
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 74 ms
77,000 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

X, Y = map(int, raw_input().split())

def is_prime(n):
    if n == 1:
        return False
    i = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += 1
    return True

if is_prime(X) and is_prime(Y):
    print "Second"
    exit()

if is_prime(X):
    cnt = 1
    X += 1
if is_prime(Y):
    cnt = 1
    Y += 1

if is_prime(X) and is_prime(Y):
    print "Second"
    exit()

x = X + 1
y = Y + 1


while not is_prime(x):
    x += 1

while not is_prime(y):
    y += 1

d = x - X + y - Y
print "First" if (d + cnt) % 2 else "Second"
0