Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Counting Tiles by Moff
from math import ceil
def checkio(r):
n = ceil(r)
a = b = 0
for x in range(1, n + 1):
for y in range(1, n + 1):
if x ** 2 + y ** 2 < r ** 2:
a += 4
if (x - 1) ** 2 + (y - 1) ** 2 <= r ** 2:
b += 4
return [a, b - a]
July 24, 2015