Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Hash(Prototipo)
//g++ 5.4.0 #include <iostream> #include <map> using namespace std; long long hashh(string entrada,int base,long long modulo){ long long suma=0; for(int i=0; i<entrada.size(); i++){ suma+=((suma%modulo)*(base%modulo)+entrada[i])%modulo; } return suma; } int main() { string entrada; long long Nueve=1000000007,Siete=1000000009, prueba; cin>>entrada; map<long long, string> hashes; prueba=hashh(entrada, 160,Nueve); hashes[hashh(entrada, 160,Nueve)]=entrada; cout<<"salida:"<<hashes[prueba]<<"\n"; cout << "Hello, world!\n"; }
run
|
edit
|
history
|
help
0
PrintShapePointer
Lowest common ancestor
cppPyBatScoreSOLID
test
.
cppPyDicCom
uuuu
1st
1
string iteration performance