90分求条(Python)
查看原帖
90分求条(Python)
1575498
fangboran楼主2025/1/2 13:01

mima = []

for i in range(10):

for j in range(10):
    for x in range(10):
        for k in range(10):
            for m in range(10):
                mima.append([i,j,x,k,m])

n = int(input())

li = [list(map(int, input().split()))for i in range(n)]

res = []

for i in li:

new = []
for j in mima:
    if i == j:
        continue
    count = 0
    index = 0
    for k in range(5):
        if i[k] != j[k]:
            count += 1
            index = k
    if count == 1:
        new.append(j)
    elif count == 2:
        if i[index - 1] != j[index]:
            if (i[index] - j[index]) % 10 == (i[index-1] - j[index-1]) % 10:
                new.append(j)        
if not res:
    res = new
else:
    temp = []
    for i in new:
        if i in res:
            temp.append(i)
    res = temp

if n == 1:

print(81)

else:

print(len(res))
2025/1/2 13:01
加载中...