Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Counting Tiles by _Chico_
def distance(x, y):
return (x**2 + y**2)**0.5
def checkio(n):
orgn = n
if n - round(n) != 0:
n = round(n+1)
whole = 0
partial = 0
for i in range(0,n):
for j in range(0, n):
if distance(i,j)<=orgn and distance(i+1, j+1)<=orgn :
whole+=1
elif distance(i,j)<=orgn and distance(i+1, j+1)>orgn :
partial += 1
return [whole*4, partial*4]
July 10, 2021