Simulation of polymers by the Monte Carlo method using the Wang-Landau algorithm