The exact solution of a mean-field monomer-dimer model with attractive potential