結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 71 ms
76,380 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 72 ms
76,560 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
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) and is_prime(Y+1)) and (is_prime(X+1) and is_prime(Y)):
    print "Second"
    exit()


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

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