- 用vector求解问题,灵活的胖子。。。
#include <bits/stdc++.h>
using namespace std;
int main() {
int m, n, t, ans = 0;
cin >> m >> n;
vector<int> v;
while (cin >> t) {
if (find(v.begin(), v.end(), t) == v.end()) {//此语法甚好
v.push_back(t);
ans++;
}
if (v.size() > m)
v.erase(v.begin());
}
cout << ans << endl;
}