题解 | 机器翻译
机器翻译
https://www.nowcoder.com/practice/45ecfecd83104f37a685016361be504c
m, n = map(int,input().split())
w = list(map(int,input().split()))
sm, ans = [], 0#栈,未命中次数
for c in w:
if c not in sm:#未命中
ans += 1
if len(sm)>=m:#栈满了,首元素出栈
sm.pop(0)
sm.append(c)#未命中新元素入栈尾
print(ans)

