Advertisement
anechka_ne_plach

Untitled

Nov 6th, 2021
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. constexpr int hashi(const char *s, int p, int mod, int index) {
  2.     return index == sizeof(s) - 1 ? 0 : index + 1 == sizeof(s) - 1 ? s[index] : ((s[index] + p * hashi(s, p, mod, index + 1)) % mod);
  3. }
  4.  
  5. constexpr int myhash(const char *s, int p, int mod) {
  6.     return hashi(s, p, mod, 0);
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement