You just need to solve the problem differently for non- perfect elastic collision. Momentum is still conserved. But the energy is not conserved.