Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- constexpr int hashi(const char *s, int p, int mod, int index) {
- return index == sizeof(s) - 1 ? 0 : index + 1 == sizeof(s) - 1 ? s[index] : ((s[index] + p * hashi(s, p, mod, index + 1)) % mod);
- }
- constexpr int myhash(const char *s, int p, int mod) {
- return hashi(s, p, mod, 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement