#39377: python參考


vincent16881688 (Strawberryyyy27)

學校 : 不指定學校
編號 : 257933
來源 : [42.70.241.130]
最後登入時間 :
2024-05-02 14:40:58
h026. 202001_1 猜拳 -- 2020年1月APCS | From: [101.136.64.68] | 發表日期 : 2024-02-11 11:55

f=int(input())
n=int(input())
a=[int(x) for x in input().split()]
ans=[]
type=[0,2,5]
time=0
pre=0
k=0
last_f=-1
for x in a:
    k+=1
    if f-x==-2 or f-x==-3 or f-x==5:
        ans.append(f)
        print(" ".join(map(str,ans)),': Won at round',k)
        break
    elif f-x==2 or f-x==3 or f-x==-5:
        ans.append(f)
        print(" ".join(map(str,ans)),': Lost at round',k)
        break

    if x==f:
        time+=1
        ans.append(f)
        if time<2:
            pre=x
            last_f=f
            f=x
        elif time==2:
            last_f=f
            if pre==5:
                f=2
            elif pre==2:
                f=0
            elif pre==0:
                f=5
            time=0
           
     
if k==n and last_f==a[n-1]:
    print(" ".join(map(str,ans)),': Drew at round',k)
           
           

   
   
 
ZeroJudge Forum