[题解]P3370 字符串哈希
本小蒟蒻看到貌似没有人用C++11的std::hash,在此发(shui)一篇题解
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int MAX=1e4+10;
hash<string> hash_s;
string m;
size_t v;
set<size_t>s;
int n;
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
cin>>n;
for(int i=0;i<n;i++){
cin>>m;
v=hash_s(m);
s.insert(v);
}
cout<<s.size()<<endl;
return 0;
}

浙公网安备 33010602011771号