标签:false log space for include -- tor sdi back
#include <vector> #include <iostream> #include <cstdio> #include <cctype> #include <string> using namespace std; vector<string> Hash[239641+10]; int tonum(char c){ if(isupper(c))return c-‘A‘; if(islower(c))return c-‘a‘+26; if(isdigit(c))return c-‘0‘+35; } bool insert(string str){ int ans=0; for(int i=0;i<str.size();i++) ans=(ans*4073+2111*tonum(str[i])+2137)%239641; for(int i=0;i<Hash[ans].size();i++) if(!(Hash[ans][i].compare(str)))return false; Hash[ans].push_back(str); return true; } int main(){ int N,ans=0; cin>>N; while(N--){ string str; cin>>str; ans+=(insert(str)); } cout<<ans; return 0; }
标签:false log space for include -- tor sdi back
原文地址:http://www.cnblogs.com/HC-LittleJian/p/7586238.html