#30714: python 解


haw206ccc@gmail.com (haw)

學校 : 不指定學校
編號 : 192448
來源 : [219.69.109.216]
最後登入時間 :
2023-08-04 23:01:51
h026. 202001_1 猜拳 -- 2020年1月APCS | From: [219.69.109.216] | 發表日期 : 2022-06-08 15:33

a=int(input())
b=int(input())
c=[int(x) for x in input().split()]
f=0
g=0
k=1
for i in range(0,1):
    if (c[0]==2 and a==0) or (c[0]==5 and a==2) or (c[0]==0 and a==5):
        print(a,end=" ")
        f=1
        break
    if (c[0]==0 and a==2) or (c[0]==2 and a==5) or (c[0]==5 and a==0):
        print(a,end=" ")
        g=1
        break
    if (c[0]==0 and a==0) or (c[0]==2 and a==2) or (c[0]==5 and a==5):
        print(a,end=" ")
        k=k+1
    for i in range(1,len(c)):
        if (c[i]==2 and a==0) or (c[i]==5 and a==2) or (c[i]==0 and a==5):
            print(a,end=" ")
            f=1
            break
        if (c[i]==0 and a==2) or (c[i]==2 and a==5) or (c[i]==5 and a==0):
            print(a,end=" ")
            g=1
            break
        if (c[i]==0 and a==0) or (c[i]==2 and a==2) or (c[i]==5 and a==5):
            print(c[i],end=" ")
            if (c[i]==c[i-1]==0):
                a=5
            if (c[i]==c[i-1]==2):
                a=0
            if (c[i]==c[i-1]==5):
                a=2
            if (c[i]!=c[i-1]):
                a=c[i]
        k=k+1
if f==1:
    print(": Won at round "+str(k))
if g==1:
    print(": Lost at round "+str(k))
if f!=1 and g!=1:
    print(": Drew at round "+str(len(c)))

 
ZeroJudge Forum