結果
問題 |
No.726 Tree Game
|
ユーザー |
|
提出日時 | 2018-08-24 21:38:14 |
言語 | PyPy2 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 606 bytes |
コンパイル時間 | 331 ms |
コンパイル使用メモリ | 76,828 KB |
実行使用メモリ | 76,796 KB |
最終ジャッジ日時 | 2024-06-23 06:52:35 |
合計ジャッジ時間 | 3,050 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 RE * 23 |
ソースコード
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"