#18102: python測試都能過,正式送出卻不行


cij@stu.cchs.chc.edu.tw (陳英杰)

學校 : 精誠中學
編號 : 68503
來源 : [118.163.188.190]
最後登入時間 :
2024-01-08 11:14:54
a291. nAnB problem | From: [1.200.52.240] | 發表日期 : 2019-06-16 19:34

import sys
for ans in sys.stdin:
    if(ans=='\n'):continue
    ans=ans.replace('\n','')
    ans=list(map(int,ans.split()))
    n=int(sys.stdin.readline())
    for i in range(n):
        a=b=0
        test=list(map(int,sys.stdin.readline().split()))
        temp=ans.copy()
        for j in range(4):
            if temp[j]==test[j]:
                a+=1
                test[j]*=-1
                temp[j]*=-1
    for k in range(4):
        if test[k]>=0:
            if test[k] in temp:
                b+=1
                temp[temp.index(test[k])]*=-1
    print('%dA%dB'%(a,b))

 
ZeroJudge Forum