-
[python]백준 가위 바위 보? 4493번알고리즘 문제풀이/백준(파이썬) 2023. 4. 25. 22:04
코드
import sys sys.stdin = open("4493.txt", "r") t=int(input()) for i in range(t): s=int(input())#가위 바위 보를 한 횟수 #R바위 P보 S가위 s1=0 s2=0 for j in range(s): a,b= map(str,input().split()) if (a=="R" and b=="S")or(a=="P" and b=="R")or(a=="S" and b=="P"):#Player 1 승자이면 +1 s1+=1 elif (b=="R" and a=="S")or(b=="P" and a=="R")or(b=="S" and a=="P"):#Player 2 승자이면 +1 s2+=1 if s1>s2: print("Player 1") elif s1<s2: print("Player 2") else: print("TIE")
링크
https://www.acmicpc.net/problem/4493
'알고리즘 문제풀이 > 백준(파이썬)' 카테고리의 다른 글
[python]백준 당신은 운명을 믿나요? 27930번 (0) 2023.04.28 [python]백준 10부제 10797번 (0) 2023.04.28 [python]백준 초코바 27959번 (0) 2023.04.27 [python]백준 특별한 학교 이름 27889번 (0) 2023.04.26 [python]백준 Majestic 10 25893번 (0) 2023.03.14