rt 我的哈希没有取模,但 int 过了。
#include <bits/stdc++.h>
using namespace std;
namespace HMFS{
const int base=233;
const int mod=1e9+7;
int n;
set<int> s;
int get_hash(string s) {
int len=s.length(),res=1;
for(int i=0;i<len;i++) {
res=res*base+s[i];
}
return res;
}
void work() {
cin>>n;
for(int i=1;i<=n;i++) {
string ss;
cin>>ss;
s.insert(get_hash(ss));
}
cout<<s.size();
}
}
int main() {
return HMFS::work(),0;
}