Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
symmetry & (solid, partial or break) solution in Clear category for Counting Tiles by Phil15
from math import ceil, hypot
def checkio(radius):
solid, partial = 0, 0
for i in range(1, ceil(radius) + 1):
for j in range(1, ceil(radius) + 1):
if hypot(i, j) <= radius:
solid += 1
elif hypot(i - 1, j - 1) < radius:
partial += 1
else:
break # Not even partial, next j won't do anything, so...
return [4 * solid, 4 * partial]
Nov. 4, 2018
Comments: