Mathematics × Programming Competition #7 - Geometrical solution