Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
6-liner: 3... 2... 1... solution in Clear category for Counting Tiles by przemyslaw.daniel
def checkio(radius, a=0, b=0):
for x, y in __import__('itertools').product(range(-4, 4), range(-4, 4)):
s = [(x, y), (x+1, y), (x, y+1), (x+1, y+1)]
c = [1 for x, y in s if abs(x+y*1j) < radius]
a, b = a+(sum(c) == 4), b+(sum(c) > 0 and sum(c) < 4)
return a, b
Feb. 8, 2017
Comments: