题解 CF937A 【Olympiad】
frankchenfu
2018-03-18 17:35:08
看了这么多题解,没有用`map`做的。
`map`表示映射关系,可以当做哈希表用。
```cpp
#include<cstdio>
#include<cstring>
#include<map>
using namespace std;
map<int,bool>hash;
int main(){
int n;scanf("%d",&n);
while(n--){
int x;scanf("%d",&x);
if(x)
hash[x]=1;
}
printf("%d\n",hash.size());
return 0;
}
```