链接:Miku
-------------------------------
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> using namespace std; const unsigned long long k=131,imp=1e7+1; unsigned long long n; string now; unsigned long long hash[1000005]; unsigned long long anss; void deal(string s,int kk){ unsigned long long l=s.length(),ans=0; for(unsigned long long i=0;i<l;++i) ans=ans*k+(unsigned long long)s[i]; hash[kk]=ans%0x7fffffff; } int main(){ cin>>n; for(unsigned long long i=1;i<=n;++i){ cin>>now; deal(now,i); } sort(hash+1,hash+1+n); for(int i=1;i<=n;++i){ if(hash[i]!=hash[i+1]){ anss++; } } cout<<anss; return 0; }