Semilinear elliptic equations with degenerate and singular weights related to Caffarelli-Kohn-Nirenberg inequalities