蓝桥杯

点击查看原文查看代码。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

#include<cstring>
#include<algorithm>
#include<vector>
#include<set>
using namespace std;
vector <int> a;
set<int> b;
void ()
{
a.push_back(1);
a.push_back(66666);
a.push_back(666);
a.push_back(6666);
a.push_back(66);
a.push_back(6677666);
a.pop_back();
a.clear();
a.push_back(1);
a.push_back(66666);
int i;
for(i=0;i<a.size();i++)
printf("%dn",a[i]);
}
void settest(){
b.insert(1);
b.insert(2);
b.insert(3);
b.insert(1);

//b.erase(4);
int j=b.count(3);
int k=b.count(5);
printf("j=%d k=%dn",j,k);
for(set<int>::iterator it=b.begin();it!=b.end();++it){
printf("%d ",(*it));
}
}
int main()
{
settest();
}