// Your First C++ Program
#include <iostream>
constexpr unsigned int hash(const char *str) {
unsigned int hash = 5381;
int c = 0;
while ((c = *str++)) {
hash = ((hash << 5) + hash) + c; // hash * 33 + c
}
return hash;
}
int main() {
const char *str = "Level::hitResult";
int a = 5381;
for (int c = *str; c; c=*++str) {
a = (((a << 5)+a)+c);
}
std::cout << a << std::endl;
std::cout << hash("Level::hitResult");
return 0;
}
Ly8gWW91ciBGaXJzdCBDKysgUHJvZ3JhbQoKI2luY2x1ZGUgPGlvc3RyZWFtPgoKY29uc3RleHByIHVuc2lnbmVkIGludCBoYXNoKGNvbnN0IGNoYXIgKnN0cikgewogICAgdW5zaWduZWQgaW50IGhhc2ggPSA1MzgxOwogICAgaW50IGMgPSAwOwoKCgogICAgd2hpbGUgKChjID0gKnN0cisrKSkgewogICAgICAgIGhhc2ggPSAoKGhhc2ggPDwgNSkgKyBoYXNoKSArIGM7IC8vIGhhc2ggKiAzMyArIGMKICAgIH0KCiAgICByZXR1cm4gaGFzaDsKfQoKaW50IG1haW4oKSB7CgoJY29uc3QgY2hhciAqc3RyID0gIkxldmVsOjpoaXRSZXN1bHQiOwoJaW50IGEgPSA1MzgxOwoJCglmb3IgKGludCBjID0gKnN0cjsgYzsgYz0qKytzdHIpIHsKCQlhID0gKCgoYSA8PCA1KSthKStjKTsKCX0KCQogICAgc3RkOjpjb3V0IDw8IGEgPDwgc3RkOjplbmRsOwoKICAgIHN0ZDo6Y291dCA8PCBoYXNoKCJMZXZlbDo6aGl0UmVzdWx0Iik7CiAgICByZXR1cm4gMDsKfQ==