Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Counting Tiles by rodka81
import math
def checkio(radius):
full = 0
partial = 0
for i in range(math.ceil(radius)):
for j in range(math.ceil(radius)):
vertices = [(i, j), (i+1, j), (i, j+1), (i+1, j+1)]
inside = [math.hypot(vx, vy) < radius for vx, vy in vertices]
if all(inside):
full += 1
elif any(inside):
partial += 1
return [full*4, partial*4]
Dec. 20, 2016