Cosmological solution in the scalar—tensor theory of gravity