시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 79 13 6 46.154%

문제

이 게임은 빨간 칩 r개와 초록 칩 g개를 책상 위에 놓고 진행한다. 두 플레이어 A와 B는 턴을 번갈아가면서 게임을 하며, A가 먼저 시작한다.

게임의 규칙은 간단하다. 자신의 턴이 돌아오면 두 색중 하나를 고른 뒤, 고른 색에 해당하는 칩 k개를 책상에서 제거한다. 이 때, k는 고른 색의 칩의 수를 나누어 떨어지게 할 수 있어야 한다. 책상에서 마지막 칩을 제거한 사람이 게임을 이기게 된다.

게임을 항상 이길 수 있는 사람을 구하는 프로그램을 작성하시오.

입력

첫째 줄에 r과 g가 주어진다. (1 ≤ r, g ≤ 109)

출력

A가 항상 이길 수 있다면 "A player wins"를, B가 항상 이길 수 있다면 "B player wins"를 출력한다.

예제 입력 1

2 1

예제 출력 1

A player wins
W3sicHJvYmxlbV9pZCI6Ijc3ODciLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWJlNjhcdWFjMDQgXHVjZTY5LCBcdWNkMDhcdWI4NWQgXHVjZTY5IiwiZGVzY3JpcHRpb24iOiI8cD5cdWM3NzQgXHVhYzhjXHVjNzg0XHVjNzQwIFx1YmU2OFx1YWMwNCBcdWNlNjkgclx1YWMxY1x1YzY0MCBcdWNkMDhcdWI4NWQgXHVjZTY5IGdcdWFjMWNcdWI5N2MgXHVjYzQ1XHVjMGMxIFx1YzcwNFx1YzVkMCBcdWIxOTNcdWFjZTAgXHVjOWM0XHVkNTg5XHVkNTVjXHViMmU0LiBcdWI0NTAgXHVkNTBjXHViODA4XHVjNzc0XHVjNWI0IEFcdWM2NDAgQlx1YjI5NCBcdWQxMzRcdWM3NDQgXHViYzg4XHVhYzA4XHVjNTQ0XHVhYzAwXHViYTc0XHVjMTFjIFx1YWM4Y1x1Yzc4NFx1Yzc0NCBcdWQ1NThcdWJhNzAsIEFcdWFjMDAgXHViYTNjXHVjODAwIFx1YzJkY1x1Yzc5MVx1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5kIHJlbW92ZSBrIGNoaXBzIG9mIHRoaXMgY29sb3IgZnJvbSB0aGUgZGVzay4gSG93ZXZlciwgayBtdXN0IGJlIGEgZGl2aXNvciBvZiB0aGUgYWN0dWFsIG51bWJlciBvZiBjaGlwcyBvZiB0aGUgb3RoZXIgY29sb3IuIFlvdSB3aW4gaWYgeW91IHJlbW92ZSB0aGUgbGFzdCBjaGlwIGZyb20gdGhlIGRlc2suIFlvdXIgdGFzayBpcyB0byBcdWZiMDFuZCB3aGljaCBwbGF5ZXIgY2FuIGZvcmNlIHRvIHdpbiB0aGlzIGdhbWUuPFwvcD5cclxuIiwiaW5wdXQiOiI8cD5JbnB1dCBcdWZiMDFsZSBjb250YWlucyB0d28gbnVtYmVycyAmbmRhc2g7IHIgYW5kIGcgKDEgJmxlOyByLGcgJmxlOyAxMDxzdXA+OTxcL3N1cD4pICZuZGFzaDsgc2VwYXJhdGVkIGJ5IGEgc3BhY2UuPFwvcD5cclxuIiwib3V0cHV0IjoiPHA+T3V0cHV0IFx1ZmIwMWxlIHNob3VsZCBjb250YWluICZyZHF1bztBIHBsYXllciB3aW5zJnJkcXVvOyBpZiBwbGF5ZXIgQSBjYW4gZm9yY2UgZ2FtZSB0byB3aW4gYW5kICZyZHF1bztCIHBsYXllciB3aW5zJnJkcXVvOyBvdGhlcndpc2UuPFwvcD5cclxuIiwiaGludCI6IiIsIm9yaWdpbmFsIjoiMSIsInByb2JsZW1fbGFuZ19jb2RlIjoiXHVjNjAxXHVjNWI0In1d

출처

Contest > KBTU Open > KBTU Open 2008 G번

  • 문제를 번역한 사람: baekjoon
  • 어색한 표현을 찾은 사람: shj5508