結果
問題 |
No.726 Tree Game
|
ユーザー |
|
提出日時 | 2020-04-29 12:45:03 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 37 ms / 2,000 ms |
コード長 | 1,194 bytes |
コンパイル時間 | 262 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-11-28 02:00:07 |
合計ジャッジ時間 | 1,748 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
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): if x == 2: print('Second') return x += 1 h,w = 1,0 while not is_prime(y): h += 1 y += 1 while not is_prime(x): w += 1 x += 1 elif is_prime(y): if y == 2: print('Second') return y += 1 h,w = 0,1 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()