关于set的些常用操作记录
#include
#define pt2(x,y) cout <<(x)<<"--"<<(y)<= int(a); i--)
#define fi first;
#define se second;
using namespace std;
typedef long long LL;
typedef pair PII;
typedef double DB;
const int N=1e9,M=1e6+10,INF=0x3f3f3f3f;
int t=1;
void solve()
{
set s; //set不包含重复元素 正常从小到大
//插入
s.insert(1);
s.insert(3);
s.insert(5);
s.insert(-5);
//遍历
for(auto ss:s) cout << ss<<" ";
hh;
// 删除
s.erase(5);
for(auto ss:s) cout << ss<<" ";
hh;
// 查找 count 返回个数
cout << s.count(1)<
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
// cin >> t;
while(t--)
{
solve();
}
return 0;
}