Skip to content

Instantly share code, notes, and snippets.

@jermenkoo
Created October 28, 2014 09:40
Show Gist options
  • Save jermenkoo/c4673d64b0248b1a0cfc to your computer and use it in GitHub Desktop.
Save jermenkoo/c4673d64b0248b1a0cfc to your computer and use it in GitHub Desktop.
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