Application of the method of characteristics to the numerical solution of one-dimensional problems in gas dynamics