[模板][字符串] 单哈希
https://oi-wiki.org/string/hash/
https://www.luogu.com.cn/problem/P3370
unsigned long long a[MAXN]; // a 数组记录哈希值
const int prime = 233317;
const unsigned long long MOD = 2123704401301379571;
const unsigned long long base = 131; // 当前进制
unsigned long long Hash(string s){
int len = s.length();
unsigned long long ans = 0;
for(int i = 0; i < len; i++){
(((ans *= base) += (unsigned long long)s[i]) %= MOD) += prime;
} // 字符串处理需要注意 0 和 <
return ans;
}
int main(){
int n ;
cin>>n;
string s;
for(int i = 1; i <= n; i++){
cin>>s;
a[i] = Hash(s);
// while(ext[a[i]]){
// a[i] += 19260817;
// a[i] += Hash(s);
// }
ext[a[i]] = 1;
}
sort(a+1, a+n+1);
int ans = 0;
for(int i = 1; i < n; i++){
if(a[i] == a[i+1]){
ans += 1;
}
}
cout<<n - ans;
return 0;
}