結果
問題 |
No.1579 New Type of Nim
|
ユーザー |
![]() |
提出日時 | 2021-07-02 22:09:27 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 813 bytes |
コンパイル時間 | 97 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-06-29 11:43:22 |
合計ジャッジ時間 | 2,114 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | AC * 8 WA * 23 |
ソースコード
A, B = map(int, input().split()) def f(a, b, turn): if a == 0 or b == 0: return turn if a >= 4: if f(3, b, turn ^ 1) == turn: return turn if a >= 3: if f(2, b, turn ^ 1) == turn: return turn if a >= 2: if f(1, b, turn ^ 1) == turn: return turn if a >= 1: if f(0, b, turn ^ 1) == turn: return turn if b >= 4: if f(a, 3, turn ^ 1) == turn: return turn if b >= 3: if f(a, 2, turn ^ 1) == turn: return turn if b >= 2: if f(a, 1, turn ^ 1) == turn: return turn if b >= 1: if f(a, 0, turn ^ 1) == turn: return turn return turn ^ 1 turn = f(A, B, 0) if turn == 0: print('P') elif turn == 1: print('Q')