文章

82

粉丝

343

获赞

27

访问

662.4k

头像
STL---Set简单使用
P1383 北京邮电大学
发布于2021年1月27日 13:01
阅读数 8.0k

#include <bits/stdc++.h>
using namespace std;
int n; 
//set 集合
//有序不重复的集合
//遍历方式: 
/*    set <int>::iterator iter=st.begin();
    while(iter!=st.end()){
        cout<<*iter<<" ";
        iter++;
    }*/ 
set <int> st;
int main(){
    while(scanf("%d",&n)!=EOF){
        st.clear();
        while(n--){
            int x;
            cin>>x;
            st.insert(x);
        }
        int y;
        cin>>y;
        set <int>::iterator iter=st.begin();
...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发