Skip to content

Latest commit

 

History

History

[15829]Hashing

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
file name src tags done draft level difficulty date
15829.md
Hashing
해싱
true
false
4
Bronze II
2021-11-06

Hashing

import sys

def input(): return sys.stdin.readline().rstrip()

# input()
# values = [(ord(c)-ord('a')+1)*(31**idx) for idx, c in enumerate(input())]
# print(sum(values))
input(), print(sum([(ord(c)-97+1)*(31**i)
                    for i, c in enumerate(input())]) % 1234567891)