The second scale is 3 times the first scale:
300, 000 / 100,000 = 3
Divide the distance by the same scale factor:
12 cm / 3 = 4 cm
Check:
The scale 1 / 100,000 means 1 cm = 1 km, so at 12 cm the cities are 12 km apart.
The second scale 1 / 300000 means 1 cm = 3 km, since the cities are 12 km apart, divide total distance by scale: 12/3 = 4 cm.