Created
October 28, 2014 09:40
-
-
Save jermenkoo/c4673d64b0248b1a0cfc 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
def a(x, y): | |
if (x == 0 or y == 0): | |
return | |
x3 = 0 | |
y3 = 0 | |
count = 0 | |
for x1 in range(-x, x + 1): | |
for y1 in range(-y, y + 1): | |
if (x1 == 0 and y1 == 0): | |
continue | |
x2 = y1 | |
y2 = -x1 | |
maxX = max(x1, max(x2, x3)) | |
minX = min(x1, min(x2, x3)) | |
maxY = max(y1, max(y2, y3)) | |
minY = min(y1, min(y2, y3)) | |
W = maxX - minX | |
H = maxY - minY | |
print("bounding: W={} H={}".format(W, H)) | |
if (W > x or H > y): | |
continue | |
count += (x - W + 1) * (y - H + 1) | |
print("({}, {}) count: {}".format(x1, y1, count)) | |
return count | |
print(a(3, 3)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment