A measurement of four branching-fraction ratios for three-body decays of B mesons involving two open-charm hadrons in the final state is presented. Run 1 and Run 2 pp collision data are used, recorded by the LHCb experiment at centre-of-mass energies 7, 8, and 13 TeV and corresponding to an integrated luminosity of 9 fb(-1). The measured branching-fraction ratios areBB+-> D+D-K+BB+-> D0D0K+=0.5170.0150.013 +/- 0.011,BB+-> D-D+K+BB+-> D0D0K+=0.577 +/- 0.016 +/- 0.013 +/- 0.013,BB0 -> D-D0K+BB0 -> D-D0K+=1.754 +/- 0.028 +/- 0.016 +/- 0.035,BB+-> D+D-K+BB+-> D-D+K+=0.907 +/- 0.033+/- 0.014,

where the first of the uncertainties is statistical, the second systematic, and the third is due to the uncertainties on the D-meson branching fractions. These are the most accurate measurements of these ratios to date.