---
# System prepended metadata

title: h026. 202001_1 猜拳

---

# h026. 202001_1 猜拳
## 題目連結: [h026](https://zerojudge.tw/ShowProblem?problemid=h026)

## 解題想法
1. 重複判斷輸贏
2. 如果有輸有贏就break掉
3. 平手就判斷哥哥下一拳要出什麼

## 程式碼
``` python=
def win(a,b): #判斷輸贏用
    if a == b:
        return "draw"
    elif (a==0 and b==2) or (a==2 and b==5) or (a==5 and b==0):
        return "a"
    else:
        return "b"

#start
brother = int(input())
N = int(input())
data = [int(i) for i in input().split()]

output = ""
isprint = False
for i in range(len(data)):
    ans = win(brother,data[i])
    output += " "+str(brother)
    
    if ans == "draw":
        if i >= 1 and data[i] == data[i-1]:
            if data[i] == 0: brother = 5
            elif data[i] == 2: brother = 0
            else: brother = 2
        else:
            brother = data[i]
    elif ans == "a":
        print(output[1:],": Won at round %d"%(i+1))
        isprint = True
        break
    elif ans == "b":
        print(output[1:],": Lost at round %d"%(i+1))
        isprint = True
        break

if isprint == False: print(output[1:],": Drew at round %d"%N)
    
