Pregunta de entrevista de Postindustria

Solve difficult problem more related to math than programming.