Let's see how to solve this algebraically....
The king will get a hit in 1/25 of the games he plays and the prince will get a hit in 1/20 of the games he plays.
So.......letting n be the number of games it will take them to get 18 hits......
(1/25)n + (1/20)n = 18
((20 + 25) / 500) n = 18 multiply both sides by 500
45n = 9000 divide both sides by 45
n = 200 games
