시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 961 658 595 72.296%

문제

가위 바위 보는 두 명이서 하는 게임이다. 보통 미리 정해놓은 수 만큼 게임을 하고, 많은 게임을 이긴 사람이 최종 승자가 된다.

가위 바위 보를 한 횟수와 매번 두 명이 무엇을 냈는지가 주어졌을 때, 최종 승자를 출력하는 프로그램을 작성하시오.

바위는 가위를 이긴다.

가위는 보를 이긴다.

보는 바위를 이긴다.

입력

첫째 줄에는 테스트 케이스의 개수 t(0 < t < 1000)가 주어진다. 각 테스트 케이스의 첫째 줄에는 가위 바위 보를 한 횟수 n(0 < n < 100)이 주어진다. 다음 n개의 줄에는 R, P, S가 공백으로 구분되어 주어진다. R, P, S는 순서대로 바위, 보, 가위이고 첫 번째 문자는 Player 1의 선택, 두 번째 문자는 Player 2의 선택이다.

출력

각 테스트 케이스에 대해서 승자를 출력한다. (Player 1 또는 Player 2) 만약, 비겼을 경우에는 TIE를 출력한다.

예제 입력 1

3
2
R P
S R
3
P P
R S
S R
1
P R

예제 출력 1

Player 2
TIE
Player 1
W3sicHJvYmxlbV9pZCI6IjQ0OTMiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWFjMDBcdWM3MDQgXHViYzE0XHVjNzA0IFx1YmNmND8iLCJkZXNjcmlwdGlvbiI6IjxwPlxyXG5cdFx1YWMwMFx1YzcwNCBcdWJjMTRcdWM3MDQgXHViY2Y0XHViMjk0IFx1YjQ1MCBcdWJhODVcdWM3NzRcdWMxMWMgXHVkNTU4XHViMjk0IFx1YWM4Y1x1Yzc4NFx1Yzc3NFx1YjJlNC4gXHViY2Y0XHVkMWI1IFx1YmJmOFx1YjlhYyBcdWM4MTVcdWQ1NzRcdWIxOTNcdWM3NDAgXHVjMjE4IFx1YjljY1x1ZDA3YyBcdWFjOGNcdWM3ODRcdWM3NDQgXHVkNTU4XHVhY2UwLCBcdWI5Y2VcdWM3NDAgXHVhYzhjXHVjNzg0XHVjNzQ0IF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oYXQgd2lucyB0aGUgZ2FtZSwgZm9sbG93ZWQgYnkgYSBuZXdsaW5lLiBJZiB0aGUgZ2FtZSBlbmRzIHVwIGluIGEgdGllLCBwcmludCBUSUUuJm5ic3A7PFwvcD5cclxuIiwiaGludCI6IiIsIm9yaWdpbmFsIjoiMSIsInByb2JsZW1fbGFuZ19jb2RlIjoiXHVjNjAxXHVjNWI0In1d

출처

ACM-ICPC > Regionals > North America > Pacific Northwest Regional > 2007 Pacific Northwest Region Programming Contest A번

  • 문제를 번역한 사람: baekjoon
  • 잘못된 데이터를 찾은 사람: dkim