#30714: python 解


haw206ccc@gmail.com (haw)

School : No School
ID : 192448
IP address : [219.69.109.216]
Last Login :
2022-07-21 13:30:03
h026. 202001_1 猜拳 -- 2020年1月APCS | From: [219.69.109.216] | Post Date : 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