Measurement of the ratio of branching fractions and difference in CP asymmetries of the decays B + → J/ψπ + and B + → J/ψK +