結果
問題 |
No.1579 New Type of Nim
|
ユーザー |
![]() |
提出日時 | 2021-07-02 22:04:52 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 653 bytes |
コンパイル時間 | 98 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-06-29 11:34:34 |
合計ジャッジ時間 | 1,731 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 8 WA * 23 |
ソースコード
A, B = map(int, input().split()) def f(a, b, turn): if a + b == 1: 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 >= 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')