#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
using namespace std;
char a[10005];
int n,m,k;
long long base;
long long ans;
long long num[10005];
int main(){
freopen("3370.in","r",stdin);
freopen("3370.out","w",stdout);
scanf("%d",&n);
k=n;ans=0;base=131;
for(int i=1;i<=n;i++){
scanf("%s",&a);
m=strlen(a);
for(int j=0;j<m;j++){
num[i]=(num[i]*base+a[j])%212370440130137957;
}
}
/
Hash(c++)
最新推荐文章于 2024-08-27 11:09:59 发布
这是一个C++程序,用于计算字符串的哈希值并进行排序。程序读取多个字符串,利用131作为基数计算每个字符串的哈希值,然后对哈希值进行排序。最后输出不重复字符串的数量。
摘要由CSDN通过智能技术生成