wa#1#2#11
查看原帖
wa#1#2#11
752257
Miangoa楼主2024/1/20 20:00
#include<bits/stdc++.h>

using namespace std;

int n;
string str;
map<unsigned long long,bool> app;

inline int read() {
	int f=1,x=0;
	char ch=getchar();
	while(ch<'0'||ch>'9')
		f=(ch=='-'?-1:f),ch=getchar();
	while(ch>='0'&&ch<='9')
		x=x*10+ch-'0',ch=getchar();
	return f*x;
}

unsigned long long h(string str) {
	unsigned long long sum=0;
	int slen=str.size();
	for(int i=0; i<slen; i++)
		sum=sum*131+str[i];
	return sum;
}

signed main() {
	n=read();
	while(n--) {
		getline(cin,str);
		app[h(str)]=true;
	}
	printf("%lld",app.size());
}
2024/1/20 20:00
加载中...