Python版,超时了,有优化的解决方法吗,大佬
查看原帖
Python版,超时了,有优化的解决方法吗,大佬
1159940
LG233666楼主2024/3/15 21:34
n = int(input())
li = list(map(int, input().split()))
l0 = [0]*7
for i in range(n):
    count = 0       # 每次执行循环时记得重新初始化count = 0
    l = list(map(int, input().split()))
    for j in l:
        if j in li:
            count += 1
    l0[7-count] += 1
for i in l0:
    print(i, end=' ')  
```Python3
2024/3/15 21:34
加载中...