A numerical solution for dynamic contact problems satisfying the velocity and acceleration compatibilities on the contact surface