文章

9

粉丝

0

获赞

29

访问

2.1k

头像
使用STL的list
P2021
发布于2025年3月4日 10:03
阅读数 334

 

 

#include <bits/stdc++.h>

using namespace std;

int main() {
    int n;
    while (cin >> n) {//不要忘记多组输入
        list<int> mylist;
        for (int i = 0; i < n; i++) {
            int a;
            cin >> a;
            //查找链表内有没有这个元素了
            if (find(mylist.begin(), mylist.end(), a) == mylist.end()) {//如果没有就尾插
                mylist.push_back...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发