Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Counting Tiles by UFO665
def pointsInCircle(x, y, r):
lstCoords = [[x, y], [x + 1, y], [x, y + 1], [x + 1, y + 1]]
return sum([int(x ** 2 + y ** 2 < r ** 2) for x, y in lstCoords])
def checkio(radius):
iSolid = 0
iPartial = 0
for x in range(-8, 8):
for y in range(8, -8, -1):
iPoints = pointsInCircle(x, y, radius)
if 0 < iPoints < 4:
iPartial += 1
elif iPoints == 4:
iSolid += 1
return [iSolid, iPartial]
Feb. 3, 2016