Students feel more comfortable with rational numbers than with irrational ones. Thus, when teaching the beginning of calculus, it is desirable to have examples of simple problems for which both zeros and extrema point are rational. Recently, an algorithm was proposed for generating cubic polynomials with this property. However, from the computational viewpoint, the existing algorithm is not the most efficient one: in addition to applying explicit formulas, it also uses trial-and-error exhaustive search. In this paper, we propose a computationally efficient algorithm for generating all such polynomials: namely, an algorithm that uses only explicit formulas.