The numerical solution of an inverse problem for a class of one-dimensional diffusion equations with piecewise constant coefficients