举例如下:

#include<cstdio>
#include<iostream>
#include<unordered_set> 
using namespace std;
main(){
    unordered_set<int> us;
    us.insert(1);
    us.insert(2);
    us.insert(3);
    cout<<us.count(6)<<endl;
    return 0;
}

count函数只会返回1,0

对于count(x)

若us中存在x,返回1,反之,返回0

相关文章:

  • 2021-06-10
  • 2021-12-06
  • 2021-12-01
  • 2021-12-01
  • 2021-09-15
  • 2022-12-23
  • 2022-12-23
  • 2021-03-31
猜你喜欢
  • 2021-11-09
  • 2021-12-09
  • 2022-12-23
  • 2021-12-11
  • 2021-12-01
  • 2021-03-31
  • 2021-04-15
相关资源
相似解决方案