Let x = time it takes for the trains to meet
Distance = (Rate)(Time)
Distance traveled by first train in x hours = 40x miles
Distance traveled by second train in x hours = 60x miles
When the trains meet, the total distance traveled by the two trains is 1000 miles.
So, 40x + 60x = 1000
100x = 1000
x = 10 hours