Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Counting Tiles by U.V
def checkio(r):
d = int(r)+1
r2 = r ** 2
full = seg = 0
for x in range(1, d + 1):
for y in range(1, d + 1):
if x * x + y * y <= r2:
full += 4
elif (x - 1) ** 2 + (y - 1) ** 2 < r2:
seg += 4
return [full, seg]
Sept. 27, 2024