Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
ceil & floor solution in Clear category for Counting Tiles by gyahun_dash
from math import ceil, floor, sqrt
#(number of tiles in the first quadrant) * 4
def checkio(radius):
ys = [sqrt(radius**2 - x**2) for x in range(ceil(radius))]
whole = sum(map(floor, ys[1:]))
partial = sum(map(ceil, ys)) - whole
return [whole * 4, partial * 4]
March 16, 2014