시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 84 16 9 52.941%

문제

이 게임은 빨간 칩 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
W3sicHJvYmxlbV9pZCI6Ijc3ODciLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWJlNjhcdWFjMDQgXHVjZTY5LCBcdWNkMDhcdWI4NWQgXHVjZTY5IiwiZGVzY3JpcHRpb24iOiI8cD5cdWM3NzQgXHVhYzhjXHVjNzg0XHVjNzQwIFx1YmU2OFx1YWMwNCBcdWNlNjkgclx1YWMxY1x1YzY0MCBcdWNkMDhcdWI4NWQgXHVjZTY5IGdcdWFjMWNcdWI5N2MgXHVjYzQ1XHVjMGMxIFx1YzcwNFx1YzVkMCBcdWIxOTNcdWFjZTAgXHVjOWM0XHVkNTg5XHVkNTVjXHViMmU0LiBcdWI0NTAgXHVkNTBjXHViODA4XHVjNzc0XHVjNWI0IEFcdWM2NDAgQlx1YjI5NCBcdWQxMzRcdWM3NDQgXHViYzg4XHVhYzA4XHVjNTQ0XHVhYzAwXHViYTc0XHVjMTFjIFx1YWM4Y1x1Yzc4NFx1Yzc0NCBcdWQ1NThcdWJhNzAsIEFcdWFjMDAgXHViYTNjXHVjODAwIFx1YzJkY1x1Yzc5MVx1Z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Bjb2xvciBhbmQgcmVtb3ZlIGsgY2hpcHMgb2YgdGhpcyBjb2xvciBmcm9tIHRoZSBkZXNrLiBIb3dldmVyLCBrIG11c3QgYmUgYSBkaXZpc29yIG9mIHRoZSBhY3R1YWwgbnVtYmVyIG9mIGNoaXBzIG9mIHRoZSBvdGhlciBjb2xvci4gWW91IHdpbiBpZiB5b3UgcmVtb3ZlIHRoZSBsYXN0IGNoaXAgZnJvbSB0aGUgZGVzay4gWW91ciB0YXNrIGlzIHRvIFx1ZmIwMW5kIHdoaWNoIHBsYXllciBjYW4gZm9yY2UgdG8gd2luIHRoaXMgZ2FtZS48XC9wPlxyXG4iLCJpbnB1dCI6IjxwPklucHV0IFx1ZmIwMWxlIGNvbnRhaW5zIHR3byBudW1iZXJzICZuZGFzaDsgciBhbmQgZyAoMSAmbGU7IHIsZyAmbGU7IDEwPHN1cD45PFwvc3VwPikgJm5kYXNoOyBzZXBhcmF0ZWQgYnkgYSBzcGFjZS48XC9wPlxyXG4iLCJvdXRwdXQiOiI8cD5PdXRwdXQgXHVmYjAxbGUgc2hvdWxkIGNvbnRhaW4gJnJkcXVvO0EgcGxheWVyIHdpbnMmcmRxdW87IGlmIHBsYXllciBBIGNhbiBmb3JjZSBnYW1lIHRvIHdpbiBhbmQgJnJkcXVvO0IgcGxheWVyIHdpbnMmcmRxdW87IG90aGVyd2lzZS48XC9wPlxyXG4iLCJoaW50IjoiIiwib3JpZ2luYWwiOiIxIiwicHJvYmxlbV9sYW5nX2NvZGUiOiJcdWM2MDFcdWM1YjQifV0=

출처

Contest > KBTU Open > KBTU Open 2008 G번

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