Last active
December 16, 2020 06:11
-
-
Save p7g/293cbfda7690505ff48959bf294b5f54 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
times = "17,x,13,19".split(",") | |
equations = [(rem, int(mod)) for rem, mod in enumerate(times) if mod != "x"] | |
M = reduce(mul, map(itemgetter(1), equations)) | |
x = 0 | |
for a, m in equations: | |
y = M // m | |
z = pow(y, -1, m) | |
x += a * y * z | |
print(x % M) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment