Created
August 4, 2020 07:17
-
-
Save riceissa/104a31bb50b9e1d50e2a22ae78d4d000 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python3 | |
x = 99901 | |
y = 6994 | |
m = 3 | |
x1 = x // (10**m) | |
x0 = x % (10**m) | |
y1 = y // (10**m) | |
y0 = y % (10**m) | |
z2 = x1 * y1 | |
z0 = x0 * y0 | |
# z1 = x1 * y0 + x0 * y1 | |
z1 = (x1 + x0)*(y1 + y0) - z2 - z0 | |
result = z2 * 10**(2*m) + z1 * 10**m + z0 | |
print("""x = {} | |
y = {} | |
x1 = {} | |
x0 = {} | |
x1 + x0 = {} | |
y1 = {} | |
y0 = {} | |
y1 + y0 = {} | |
z2 = {} | |
z1 = {} | |
z0 = {} | |
result = {} | |
result_correct = {}""".format(x, y, x1, x0, x1 + x0, y1, y0, y1 + y0, z2, z1, z0, result, x*y)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output: