Pergunta de entrevista da empresa Agero

Derive a mathematical formula for a given scenario and then write a pseudo code